Version Description
- NEW: Vertical align option for table cells.
- NEW: More border customizations.
- NEW: Target width option for responsive menu.
- NEW:
nofollow
option for text links. - IMPROVEMENT: Element control show/hide logic updated.
- IMPROVEMENT: Visibility of main tab buttons updated.
- IMPROVEMENT: Better suffix display for range sliders.
- FIX: An issue affecting sub-folder WordPress installations.
- FIX: An issue targeting usage of YouTube embeds in Custom HTML element.
- UPDATE: Freemius SDK.
Download this release
Release Info
Developer | imtiazrayhan |
Plugin | WP Table Builder – WordPress Table Plugin |
Version | 1.2.6 |
Comparing to | |
See all releases |
Code changes from version 1.2.5 to 1.2.6
- inc/admin/class-wptb-listing.php +3 -1
- inc/admin/controls/control-alignment.php +67 -24
- inc/admin/controls/control-color.php +12 -12
- inc/admin/controls/control-icon-select.php +11 -11
- inc/admin/controls/control-named-toggle.php +62 -0
- inc/admin/controls/control-range.php +19 -17
- inc/admin/controls/control-sides.php +0 -1
- inc/admin/css/admin.css +78 -3
- inc/admin/element-classes/base/element-base.php +32 -31
- inc/admin/element-classes/element-scripts/custom-html-element.js +16 -1
- inc/admin/element-classes/element-scripts/text-element.js +4 -0
- inc/admin/element-classes/elements/button-element.php +41 -23
- inc/admin/js/WPTB_BuilderControls.js +32 -21
- inc/admin/js/WPTB_Import_Menu.js +1 -1
- inc/admin/js/WPTB_ResponsiveFrontend.js +28 -7
- inc/admin/js/admin.js +569 -368
- inc/admin/js/admin.js.map +1 -1
inc/admin/class-wptb-listing.php
CHANGED
@@ -329,7 +329,9 @@ class WPTB_Listing extends \WP_List_Table{
|
|
329 |
$this->request_url_clear();
|
330 |
?>
|
331 |
<script>
|
332 |
-
|
|
|
|
|
333 |
</script>
|
334 |
<?php
|
335 |
}
|
329 |
$this->request_url_clear();
|
330 |
?>
|
331 |
<script>
|
332 |
+
// with sub-folder WordPress installations, this function adding extra invalid url paths to browser history, thus changing all the links that formats themselves according to current url. since the url it created is invalid, most of the links on the page become invalid and broken too.
|
333 |
+
// @deprecated
|
334 |
+
//window.history.pushState( null, null, "<?php //echo home_url() . $_SERVER['REQUEST_URI']; ?>//" );
|
335 |
</script>
|
336 |
<?php
|
337 |
}
|
inc/admin/controls/control-alignment.php
CHANGED
@@ -63,12 +63,23 @@ class Control_Alignment extends Base_Control {
|
|
63 |
center,
|
64 |
right,
|
65 |
dataElement,
|
|
|
66 |
targetAddClass;
|
|
|
67 |
|
68 |
if( data.label ) {
|
69 |
label = data.label;
|
70 |
}
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
if( 'selected' in data ) {
|
73 |
if( data.selected == 0 ) {
|
74 |
selected0 = 'bnt-selected';
|
@@ -105,24 +116,54 @@ class Control_Alignment extends Base_Control {
|
|
105 |
ob_start();
|
106 |
require NS\WP_TABLE_BUILDER_DIR . 'inc/admin/views/builder/icons/right_align.php';
|
107 |
$right_align_image_svg = ob_get_clean();
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
<p class="wptb-settings-item-title">{{{label}}}</p>
|
111 |
</div>
|
112 |
<div class="wptb-settings-row wptb-settings-middle-xs" style="padding-bottom: 0px; padding-top: 23px;">
|
113 |
<ul class="wptb-controls-ul-row">
|
114 |
<li class="wptb-btn-size-btn wptb-element-property wptb-btn-size-switcher wptb-button-svg-center
|
115 |
-
{{{selected0}}} {{{targetAddClass}}}" data-alignment-value="
|
|
|
|
|
116 |
<?php echo $left_align_image_svg; ?>
|
|
|
|
|
|
|
|
|
117 |
</li>
|
118 |
<li class="wptb-btn-size-btn wptb-element-property wptb-btn-size-switcher wptb-button-svg-center
|
119 |
-
{{{selected1}}} {{{targetAddClass}}}" data-alignment-value="
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
125 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
</ul>
|
127 |
</div>
|
128 |
|
@@ -160,13 +201,14 @@ class Control_Alignment extends Base_Control {
|
|
160 |
convertValue = 'right';
|
161 |
}
|
162 |
} else {
|
163 |
-
if( value == 'left' ) {
|
164 |
-
convertValue = 'left'
|
165 |
-
} else if( value == 'center' ) {
|
166 |
-
convertValue = 'center'
|
167 |
-
} else if( value == 'right' ) {
|
168 |
-
convertValue = 'right'
|
169 |
-
}
|
|
|
170 |
}
|
171 |
|
172 |
if( typeof selectorElements[j].style[selectors[i][1]] != 'undefined' ) {
|
@@ -199,13 +241,14 @@ class Control_Alignment extends Base_Control {
|
|
199 |
return 'right';
|
200 |
}
|
201 |
} else {
|
202 |
-
if( gettingElementValue == 'left' ) {
|
203 |
-
return 'left'
|
204 |
-
} else if( gettingElementValue == 'center' ) {
|
205 |
-
return 'center'
|
206 |
-
} else if( gettingElementValue == 'right' ) {
|
207 |
-
return 'right'
|
208 |
-
}
|
|
|
209 |
}
|
210 |
}
|
211 |
}
|
63 |
center,
|
64 |
right,
|
65 |
dataElement,
|
66 |
+
alignmentAxis = 'horizontal',
|
67 |
targetAddClass;
|
68 |
+
|
69 |
|
70 |
if( data.label ) {
|
71 |
label = data.label;
|
72 |
}
|
73 |
+
|
74 |
+
if( data.alignmentAxis ) {
|
75 |
+
alignmentAxis = data.alignmentAxis;
|
76 |
+
}
|
77 |
+
|
78 |
+
let alignmentValues = ['left', 'center', 'right'];
|
79 |
+
if( alignmentAxis === 'vertical' ) {
|
80 |
+
alignmentValues = ['top' , 'center', 'bottom'];
|
81 |
+
}
|
82 |
+
|
83 |
if( 'selected' in data ) {
|
84 |
if( data.selected == 0 ) {
|
85 |
selected0 = 'bnt-selected';
|
116 |
ob_start();
|
117 |
require NS\WP_TABLE_BUILDER_DIR . 'inc/admin/views/builder/icons/right_align.php';
|
118 |
$right_align_image_svg = ob_get_clean();
|
119 |
+
|
120 |
+
ob_start();
|
121 |
+
require NS\WP_TABLE_BUILDER_DIR . 'inc/admin/views/builder/icons/top_align.svg';
|
122 |
+
$top_align_image_svg = ob_get_clean();
|
123 |
+
|
124 |
+
ob_start();
|
125 |
+
require NS\WP_TABLE_BUILDER_DIR . 'inc/admin/views/builder/icons/vertical_center_align.svg';
|
126 |
+
$vertical_center_align_svg = ob_get_clean();
|
127 |
+
|
128 |
+
ob_start();
|
129 |
+
require NS\WP_TABLE_BUILDER_DIR . 'inc/admin/views/builder/icons/bottom_align.svg';
|
130 |
+
$bottom_align_svg = ob_get_clean();
|
131 |
+
?>
|
132 |
+
<div class="wptb-settings-item-header">
|
133 |
<p class="wptb-settings-item-title">{{{label}}}</p>
|
134 |
</div>
|
135 |
<div class="wptb-settings-row wptb-settings-middle-xs" style="padding-bottom: 0px; padding-top: 23px;">
|
136 |
<ul class="wptb-controls-ul-row">
|
137 |
<li class="wptb-btn-size-btn wptb-element-property wptb-btn-size-switcher wptb-button-svg-center
|
138 |
+
{{{selected0}}} {{{targetAddClass}}}" data-alignment-value="{{{alignmentValues[0]}}}" data-element="{{{elemContainer}}}">
|
139 |
+
<# if(alignmentAxis === 'horizontal'){
|
140 |
+
#>
|
141 |
<?php echo $left_align_image_svg; ?>
|
142 |
+
<# }else{
|
143 |
+
#>
|
144 |
+
<?php echo $top_align_image_svg; ?>
|
145 |
+
<# } #>
|
146 |
</li>
|
147 |
<li class="wptb-btn-size-btn wptb-element-property wptb-btn-size-switcher wptb-button-svg-center
|
148 |
+
{{{selected1}}} {{{targetAddClass}}}" data-alignment-value="{{{alignmentValues[1]}}}" data-element="{{{elemContainer}}}">
|
149 |
+
<# if(alignmentAxis === 'horizontal'){
|
150 |
+
#>
|
151 |
+
<?php echo $center_align_image_svg; ?>
|
152 |
+
<# }else{
|
153 |
+
#>
|
154 |
+
<?php echo $vertical_center_align_svg; ?>
|
155 |
+
<# } #>
|
156 |
</li>
|
157 |
+
<li class="wptb-btn-size-btn wptb-element-property wptb-btn-size-switcher wptb-button-svg-center
|
158 |
+
{{{selected2}}} {{{targetAddClass}}}" data-alignment-value="{{{alignmentValues[2]}}}" data-element="{{{elemContainer}}}">
|
159 |
+
<# if(alignmentAxis === 'horizontal'){
|
160 |
+
#>
|
161 |
+
<?php echo $right_align_image_svg; ?>
|
162 |
+
<# }else{
|
163 |
+
#>
|
164 |
+
<?php echo $bottom_align_svg; ?>
|
165 |
+
<# } #>
|
166 |
+
</li>
|
167 |
</ul>
|
168 |
</div>
|
169 |
|
201 |
convertValue = 'right';
|
202 |
}
|
203 |
} else {
|
204 |
+
<!-- if( value == 'left' ) {-->
|
205 |
+
<!-- convertValue = 'left';-->
|
206 |
+
<!-- } else if( value == 'center' ) {-->
|
207 |
+
<!-- convertValue = 'center';-->
|
208 |
+
<!-- } else if( value == 'right' ) {-->
|
209 |
+
<!-- convertValue = 'right';-->
|
210 |
+
<!-- }-->
|
211 |
+
convertValue = value;
|
212 |
}
|
213 |
|
214 |
if( typeof selectorElements[j].style[selectors[i][1]] != 'undefined' ) {
|
241 |
return 'right';
|
242 |
}
|
243 |
} else {
|
244 |
+
<!-- if( gettingElementValue == 'left' ) {-->
|
245 |
+
<!-- return 'left';-->
|
246 |
+
<!-- } else if( gettingElementValue == 'center' ) {-->
|
247 |
+
<!-- return 'center';-->
|
248 |
+
<!-- } else if( gettingElementValue == 'right' ) {-->
|
249 |
+
<!-- return 'right';-->
|
250 |
+
<!-- }-->
|
251 |
+
return gettingElementValue;
|
252 |
}
|
253 |
}
|
254 |
}
|
inc/admin/controls/control-color.php
CHANGED
@@ -55,7 +55,6 @@ class Control_Color extends Base_Control {
|
|
55 |
name,
|
56 |
selectors = [],
|
57 |
elemContainer,
|
58 |
-
selectorsJson,
|
59 |
useDataset,
|
60 |
targetInputAddClass,
|
61 |
dataSets,
|
@@ -91,16 +90,14 @@ class Control_Color extends Base_Control {
|
|
91 |
i++;
|
92 |
}
|
93 |
|
94 |
-
if( selectors && Array.isArray( selectors ) ) {
|
95 |
-
selectorsJson = JSON.stringify( selectors );
|
96 |
-
}
|
97 |
-
|
98 |
if( data.elemContainer ) {
|
99 |
elemContainer = data.elemContainer;
|
100 |
}
|
101 |
|
102 |
targetInputAddClass = data.elementControlTargetUnicClass;
|
103 |
-
|
|
|
|
|
104 |
#>
|
105 |
<div id="{{{targetInputAddClass}}}">
|
106 |
<div class='wptb-settings-item-header'>
|
@@ -138,16 +135,18 @@ class Control_Color extends Base_Control {
|
|
138 |
}
|
139 |
|
140 |
if( targetInput && selectorElement ) {
|
141 |
-
if( '{{{
|
142 |
-
let selectors =
|
143 |
|
144 |
let thisColorCss, thisColorCssHex;
|
145 |
for( let i = 0; i < selectors.length; i++ ) {
|
146 |
if( selectors[i] && Array.isArray( selectors[i] ) && selectors[i][0] && selectors[i][1] ) {
|
147 |
let selectorElements = document.querySelectorAll( selectors[i][0] );
|
148 |
if( selectorElements.length > 0 ) {
|
|
|
149 |
for( let j = 0; j < selectorElements.length; j++ ) {
|
150 |
if( selectors[i][1] ) {
|
|
|
151 |
if( Array.isArray( selectors[i][1] ) ) {
|
152 |
for( let k = 0; k < selectors[i][1].length; k++ ) {
|
153 |
if( selectorElements[j].style[selectors[i][1][k]] ) {
|
@@ -177,16 +176,17 @@ class Control_Color extends Base_Control {
|
|
177 |
}
|
178 |
}
|
179 |
|
180 |
-
|
181 |
-
targetInput.value = thisColorCss;
|
182 |
-
}
|
183 |
}
|
184 |
}
|
|
|
|
|
|
|
|
|
185 |
}
|
186 |
}
|
187 |
}
|
188 |
|
189 |
-
|
190 |
function elementColorSet( selectors, color) {
|
191 |
const useDataset = 'true' === '{{{useDataset}}}';
|
192 |
if(useDataset){
|
55 |
name,
|
56 |
selectors = [],
|
57 |
elemContainer,
|
|
|
58 |
useDataset,
|
59 |
targetInputAddClass,
|
60 |
dataSets,
|
90 |
i++;
|
91 |
}
|
92 |
|
|
|
|
|
|
|
|
|
93 |
if( data.elemContainer ) {
|
94 |
elemContainer = data.elemContainer;
|
95 |
}
|
96 |
|
97 |
targetInputAddClass = data.elementControlTargetUnicClass;
|
98 |
+
if(!window[targetInputAddClass]) window[targetInputAddClass] = [];
|
99 |
+
if(!window[targetInputAddClass]['control-color']) window[targetInputAddClass]['control-color'] = [];
|
100 |
+
window[targetInputAddClass]['control-color']['selectors'] = selectors;
|
101 |
#>
|
102 |
<div id="{{{targetInputAddClass}}}">
|
103 |
<div class='wptb-settings-item-header'>
|
135 |
}
|
136 |
|
137 |
if( targetInput && selectorElement ) {
|
138 |
+
if( window['{{{targetInputAddClass}}}']['control-color']['selectors'] ) {
|
139 |
+
let selectors = window['{{{targetInputAddClass}}}']['control-color']['selectors'];
|
140 |
|
141 |
let thisColorCss, thisColorCssHex;
|
142 |
for( let i = 0; i < selectors.length; i++ ) {
|
143 |
if( selectors[i] && Array.isArray( selectors[i] ) && selectors[i][0] && selectors[i][1] ) {
|
144 |
let selectorElements = document.querySelectorAll( selectors[i][0] );
|
145 |
if( selectorElements.length > 0 ) {
|
146 |
+
let thisColorCssArr = [];
|
147 |
for( let j = 0; j < selectorElements.length; j++ ) {
|
148 |
if( selectors[i][1] ) {
|
149 |
+
thisColorCss = '';
|
150 |
if( Array.isArray( selectors[i][1] ) ) {
|
151 |
for( let k = 0; k < selectors[i][1].length; k++ ) {
|
152 |
if( selectorElements[j].style[selectors[i][1][k]] ) {
|
176 |
}
|
177 |
}
|
178 |
|
179 |
+
thisColorCssArr.push(thisColorCss);
|
|
|
|
|
180 |
}
|
181 |
}
|
182 |
+
|
183 |
+
if( thisColorCssArr.length > 0 ) {
|
184 |
+
targetInput.value = WPTB_Helper.getValueMaxCountSameElementsInArray(thisColorCssArr);
|
185 |
+
}
|
186 |
}
|
187 |
}
|
188 |
}
|
189 |
|
|
|
190 |
function elementColorSet( selectors, color) {
|
191 |
const useDataset = 'true' === '{{{useDataset}}}';
|
192 |
if(useDataset){
|
inc/admin/controls/control-icon-select.php
CHANGED
@@ -45,18 +45,18 @@ class Control_Icon_Select extends Base_Control {
|
|
45 |
*/
|
46 |
public function content_template() {
|
47 |
?>
|
48 |
-
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
<?php
|
61 |
}
|
62 |
}
|
45 |
*/
|
46 |
public function content_template() {
|
47 |
?>
|
48 |
+
<#
|
49 |
+
const uniqueItemClass = data.elementControlTargetUnicClass;
|
50 |
|
51 |
+
WPTB_ControlsManager.setControlData(uniqueItemClass , data);
|
52 |
+
#>
|
53 |
+
<div id="{{{uniqueItemClass}}}">
|
54 |
+
<icon-select-control :label="label" :icons="icons" :per-page="perPage"
|
55 |
+
:selectors="selectors" :default-value="defaultValue"></icon-select-control>
|
56 |
+
</div>
|
57 |
+
<wptb-template-script>
|
58 |
+
WPTB_ControlsManager.callControlScript('ControlIconSelect','{{{uniqueItemClass}}}');
|
59 |
+
</wptb-template-script>
|
60 |
<?php
|
61 |
}
|
62 |
}
|
inc/admin/controls/control-named-toggle.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WP_Table_Builder\Inc\Admin\Controls;
|
4 |
+
|
5 |
+
// if called directly, abort
|
6 |
+
if ( ! defined( 'WPINC' ) ) {
|
7 |
+
die;
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class Control_Named_Toggle
|
12 |
+
*
|
13 |
+
* Toggle control with names as visuals
|
14 |
+
*
|
15 |
+
* Accepted options
|
16 |
+
* label => label for control element
|
17 |
+
* selectors => selector array to get/set certain values to html elements
|
18 |
+
* items => a key/value array container toggle item id as keys and its translated title as value
|
19 |
+
* defaultValue => a default value of the control
|
20 |
+
*
|
21 |
+
* @package WP_Table_Builder\Inc\Admin\Controls
|
22 |
+
*/
|
23 |
+
class Control_Named_Toggle extends Base_Control {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Get control type.
|
27 |
+
*
|
28 |
+
* Return the control type.
|
29 |
+
*
|
30 |
+
* @since 1.1.2
|
31 |
+
* @access public
|
32 |
+
*/
|
33 |
+
public function get_type() {
|
34 |
+
return 'named_toggle';
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Control content template.
|
39 |
+
*
|
40 |
+
* Used to generate the control HTML in the editor using wp js template
|
41 |
+
*
|
42 |
+
* @since 1.1.2
|
43 |
+
* @access public
|
44 |
+
*/
|
45 |
+
public function content_template() {
|
46 |
+
?>
|
47 |
+
<#
|
48 |
+
const uniqueItemClass = data.elementControlTargetUnicClass;
|
49 |
+
WPTB_ControlsManager.setControlData(uniqueItemClass, data);
|
50 |
+
const elemContainer = data.elemContainer;
|
51 |
+
#>
|
52 |
+
<div id="{{{uniqueItemClass}}}">
|
53 |
+
<named-toggle-control :label="label" :items="items" :selectors="selectors" :default-value="defaultValue"
|
54 |
+
elem-container="{{{elemContainer}}}"
|
55 |
+
unique-id="{{{uniqueItemClass}}}"></named-toggle-control>
|
56 |
+
</div>
|
57 |
+
<wptb-template-script>
|
58 |
+
WPTB_ControlsManager.callControlScript('ControlNamedToggle', '{{{uniqueItemClass}}}');
|
59 |
+
</wptb-template-script>
|
60 |
+
<?php
|
61 |
+
}
|
62 |
+
}
|
inc/admin/controls/control-range.php
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
|
3 |
namespace WP_Table_Builder\Inc\Admin\Controls;
|
4 |
|
5 |
-
use WP_Table_Builder as NS;
|
6 |
|
7 |
// if called directly, abort
|
8 |
if ( ! defined( 'WPINC' ) ) {
|
@@ -21,7 +20,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
21 |
* max => maximum value of the slider
|
22 |
* step => step value of the slider
|
23 |
* defaultValue => default value of the slider
|
24 |
-
*
|
25 |
*
|
26 |
* @package WP_Table_Builder\Inc\Admin\Controls
|
27 |
*/
|
@@ -49,20 +48,23 @@ class Control_Range extends Base_Control {
|
|
49 |
*/
|
50 |
public function content_template() {
|
51 |
?>
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
<
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
65 |
<?php
|
66 |
}
|
67 |
-
}
|
68 |
-
|
2 |
|
3 |
namespace WP_Table_Builder\Inc\Admin\Controls;
|
4 |
|
|
|
5 |
|
6 |
// if called directly, abort
|
7 |
if ( ! defined( 'WPINC' ) ) {
|
20 |
* max => maximum value of the slider
|
21 |
* step => step value of the slider
|
22 |
* defaultValue => default value of the slider
|
23 |
+
* postFix => suffix to be added to the end of value
|
24 |
*
|
25 |
* @package WP_Table_Builder\Inc\Admin\Controls
|
26 |
*/
|
48 |
*/
|
49 |
public function content_template() {
|
50 |
?>
|
51 |
+
<#
|
52 |
+
const uniqueItemClass = data.elementControlTargetUnicClass;
|
53 |
+
WPTB_ControlsManager.setControlData(uniqueItemClass, data);
|
54 |
+
const elemContainer = data.elemContainer;
|
55 |
+
|
56 |
+
if(!data.postFix){
|
57 |
+
data.postFix='';
|
58 |
+
}
|
59 |
+
#>
|
60 |
+
<div id="{{{uniqueItemClass}}}">
|
61 |
+
<range-control :label="label" :selectors="selectors" :min="min" :max="max" :step="step"
|
62 |
+
:default-value="defaultValue" unique-id="{{{uniqueItemClass}}}"
|
63 |
+
elem-container="{{{elemContainer}}}" :post-fix="postFix"></range-control>
|
64 |
+
</div>
|
65 |
+
<wptb-template-script>
|
66 |
+
WPTB_ControlsManager.callControlScript('ControlRange', '{{{uniqueItemClass}}}');
|
67 |
+
</wptb-template-script>
|
68 |
<?php
|
69 |
}
|
70 |
+
}
|
|
inc/admin/controls/control-sides.php
CHANGED
@@ -64,7 +64,6 @@ class Control_Sides extends Base_Control {
|
|
64 |
<#
|
65 |
const uniqueItemClass = data.elementControlTargetUnicClass;
|
66 |
WPTB_ControlsManager.setControlData(uniqueItemClass, data);
|
67 |
-
const elemContainer = data.elemContainer;
|
68 |
data.strings = JSON.parse('<?php echo $json_strings; ?>');
|
69 |
data.icons = JSON.parse('<?php echo $json_icons; ?>');
|
70 |
#>
|
64 |
<#
|
65 |
const uniqueItemClass = data.elementControlTargetUnicClass;
|
66 |
WPTB_ControlsManager.setControlData(uniqueItemClass, data);
|
|
|
67 |
data.strings = JSON.parse('<?php echo $json_strings; ?>');
|
68 |
data.icons = JSON.parse('<?php echo $json_icons; ?>');
|
69 |
#>
|
inc/admin/css/admin.css
CHANGED
@@ -1178,6 +1178,7 @@ ul.wptb-tabs {
|
|
1178 |
grid-template-columns: 1fr;
|
1179 |
grid-template-areas: "header" "tabButtons" "controls";
|
1180 |
grid-auto-flow: row;
|
|
|
1181 |
}
|
1182 |
|
1183 |
.wptb-section-group-tabbed-header {
|
@@ -1204,11 +1205,20 @@ ul.wptb-tabs {
|
|
1204 |
|
1205 |
.wptb-section-group-tab-content {
|
1206 |
grid-area: controls;
|
1207 |
-
animation: wptb-basic-appear 0.2s ease-out
|
|
|
1208 |
}
|
1209 |
|
1210 |
.wptb-plugin-non-visible {
|
1211 |
-
display: none !important
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1212 |
}
|
1213 |
|
1214 |
/**
|
@@ -1376,7 +1386,8 @@ ul.wptb-tabs {
|
|
1376 |
margin-top: 30px;
|
1377 |
margin-bottom: 30px;
|
1378 |
max-width: 700px;
|
1379 |
-
overflow:
|
|
|
1380 |
}
|
1381 |
|
1382 |
#wptb-cell_mode_background {
|
@@ -1733,6 +1744,10 @@ table.wptb-table {
|
|
1733 |
display: none;
|
1734 |
}
|
1735 |
|
|
|
|
|
|
|
|
|
1736 |
.wptb-plugin-button-order-right .wptb-button-icon {
|
1737 |
order: 2;
|
1738 |
}
|
@@ -3007,6 +3022,10 @@ wptb_shortcode_container_element {
|
|
3007 |
color: #CBD5E0 !important;
|
3008 |
}
|
3009 |
|
|
|
|
|
|
|
|
|
3010 |
.wptb-menu-active-section-indicator {
|
3011 |
position: absolute;
|
3012 |
border-bottom: 2px solid #1A202C;
|
@@ -4160,3 +4179,59 @@ wptb_shortcode_container_element {
|
|
4160 |
|
4161 |
/*endregion*/
|
4162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1178 |
grid-template-columns: 1fr;
|
1179 |
grid-template-areas: "header" "tabButtons" "controls";
|
1180 |
grid-auto-flow: row;
|
1181 |
+
grid-template-rows: auto;
|
1182 |
}
|
1183 |
|
1184 |
.wptb-section-group-tabbed-header {
|
1205 |
|
1206 |
.wptb-section-group-tab-content {
|
1207 |
grid-area: controls;
|
1208 |
+
/*animation: wptb-basic-appear 0.2s ease-out;*/
|
1209 |
+
transition: opacity 0.2s ease-out;
|
1210 |
}
|
1211 |
|
1212 |
.wptb-plugin-non-visible {
|
1213 |
+
/*display: none !important;*/
|
1214 |
+
height: 0;
|
1215 |
+
opacity: 0;
|
1216 |
+
pointer-events: none;
|
1217 |
+
transition: none !important;
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
.wptb-plugin-non-visible div {
|
1221 |
+
height: 0;
|
1222 |
}
|
1223 |
|
1224 |
/**
|
1386 |
margin-top: 30px;
|
1387 |
margin-bottom: 30px;
|
1388 |
max-width: 700px;
|
1389 |
+
overflow-x: auto;
|
1390 |
+
overflow-y: hidden;
|
1391 |
}
|
1392 |
|
1393 |
#wptb-cell_mode_background {
|
1744 |
display: none;
|
1745 |
}
|
1746 |
|
1747 |
+
[data-wptb-button-icon-position='right'] .wptb-button-icon {
|
1748 |
+
order: 2
|
1749 |
+
}
|
1750 |
+
|
1751 |
.wptb-plugin-button-order-right .wptb-button-icon {
|
1752 |
order: 2;
|
1753 |
}
|
3022 |
color: #CBD5E0 !important;
|
3023 |
}
|
3024 |
|
3025 |
+
.wptb-panel-tabs .wptb-settings-section-item.disabled{
|
3026 |
+
color: inherit !important;
|
3027 |
+
}
|
3028 |
+
|
3029 |
.wptb-menu-active-section-indicator {
|
3030 |
position: absolute;
|
3031 |
border-bottom: 2px solid #1A202C;
|
4179 |
|
4180 |
/*endregion*/
|
4181 |
|
4182 |
+
/*region named toggle control*/
|
4183 |
+
.wptb-named-toggle-control-wrapper {
|
4184 |
+
position: relative;
|
4185 |
+
min-height: 30px;
|
4186 |
+
display: grid;
|
4187 |
+
grid-template-columns: 1fr;
|
4188 |
+
grid-auto-columns: 1fr;
|
4189 |
+
grid-auto-flow: column;
|
4190 |
+
justify-content: center;
|
4191 |
+
align-items: center;
|
4192 |
+
border: 1px solid var(--wptb-plugin-gray-400);
|
4193 |
+
border-radius: 5px;
|
4194 |
+
background-color: var(--wptb-plugin-white);
|
4195 |
+
overflow: hidden;
|
4196 |
+
}
|
4197 |
+
|
4198 |
+
.wptb-named-toggle-item {
|
4199 |
+
display: flex;
|
4200 |
+
justify-content: center;
|
4201 |
+
align-items: center;
|
4202 |
+
text-wrap: avoid;
|
4203 |
+
padding: 10px;
|
4204 |
+
z-index: 10;
|
4205 |
+
cursor: pointer;
|
4206 |
+
color: var(--wptb-plugin-gray-400);
|
4207 |
+
font-weight: bold;
|
4208 |
+
font-size: 90% !important;
|
4209 |
+
}
|
4210 |
+
|
4211 |
+
.wptb-named-toggle-item[data-wptb-named-toggle-active='true'] {
|
4212 |
+
color: var(--wptb-plugin-white);
|
4213 |
+
}
|
4214 |
+
|
4215 |
+
.wptb-named-toggle-active-indicator {
|
4216 |
+
position: absolute;
|
4217 |
+
height: 100%;
|
4218 |
+
background-color: var(--wptb-plugin-logo-color);
|
4219 |
+
z-index: 9;
|
4220 |
+
transition: left 0.2s ease-out;
|
4221 |
+
}
|
4222 |
+
|
4223 |
+
/*endregion*/
|
4224 |
+
|
4225 |
+
/*region cell vertical alignment*/
|
4226 |
+
.wptb-cell[data-wptb-cell-vertical-alignment="top"] {
|
4227 |
+
vertical-align: baseline;
|
4228 |
+
}
|
4229 |
+
|
4230 |
+
.wptb-cell[data-wptb-cell-vertical-alignment="center"] {
|
4231 |
+
vertical-align: center;
|
4232 |
+
}
|
4233 |
+
|
4234 |
+
.wptb-cell[data-wptb-cell-vertical-alignment="bottom"] {
|
4235 |
+
vertical-align: bottom;
|
4236 |
+
}
|
4237 |
+
/*endregion*/
|
inc/admin/element-classes/base/element-base.php
CHANGED
@@ -59,29 +59,30 @@ abstract class Element_Base extends Element_Base_Object {
|
|
59 |
protected function _content_template() {
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
85 |
|
86 |
/**
|
87 |
* Output element template and script.
|
@@ -103,9 +104,9 @@ abstract class Element_Base extends Element_Base_Object {
|
|
103 |
}
|
104 |
|
105 |
?>
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
|
110 |
<?php
|
111 |
}
|
@@ -124,12 +125,12 @@ abstract class Element_Base extends Element_Base_Object {
|
|
124 |
|
125 |
|
126 |
/**
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
* @return string position relative
|
131 |
*/
|
132 |
-
public function position_relative(
|
133 |
-
|
134 |
}
|
135 |
}
|
59 |
protected function _content_template() {
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* Get a list of available icons through icon manager.
|
64 |
+
*
|
65 |
+
* @param string $extension file extension to filter out results
|
66 |
+
*
|
67 |
+
* @return array associated array of icon list, keys for icon names and values for icon urls
|
68 |
+
*/
|
69 |
+
protected function read_icons( $extension = 'svg' ) {
|
70 |
+
return Init::instance()->get_icon_manager()->get_icon_list( $extension );
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get an icon through icon manager.
|
76 |
+
*
|
77 |
+
* @param string $name icon name
|
78 |
+
* @param boolean $echo echo to output buffer
|
79 |
+
* @param string $extension extra filename info for icon
|
80 |
+
*
|
81 |
+
* @return string|void return a string representation of the icon of void depending on to chose to output to buffer
|
82 |
+
*/
|
83 |
+
protected function get_icon( $name, $echo = false, $extension = 'svg' ) {
|
84 |
+
return Init::instance()->get_icon_manager()->get_icon( $name, $echo, $extension );
|
85 |
+
}
|
86 |
|
87 |
/**
|
88 |
* Output element template and script.
|
104 |
}
|
105 |
|
106 |
?>
|
107 |
+
<script type="text/html" id="tmpl-wptb-<?php echo esc_attr( $this->get_name() ); ?>-content">
|
108 |
+
<?php echo $template_content; ?>
|
109 |
+
</script>
|
110 |
|
111 |
<?php
|
112 |
}
|
125 |
|
126 |
|
127 |
/**
|
128 |
+
* Get relative of element
|
129 |
+
* This function will be used to determine the positioning of elements on drop events
|
130 |
+
*
|
131 |
* @return string position relative
|
132 |
*/
|
133 |
+
public function position_relative() {
|
134 |
+
return Elements_Manager::ELEMENT_RELATIVE;
|
135 |
}
|
136 |
}
|
inc/admin/element-classes/element-scripts/custom-html-element.js
CHANGED
@@ -2,7 +2,22 @@ const infArr = element.className.match(/wptb-element-((.+-)\d+)/i);
|
|
2 |
const controlKey = 'textarea';
|
3 |
const elementControlTargetUnicClass = `wptb-el-${infArr[1]}-${controlKey}`;
|
4 |
|
5 |
-
const allowedChildrenTags = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
const innerChildTextArray = Array.from(allowedChildrenTags);
|
8 |
innerChildTextArray.push('#text');
|
2 |
const controlKey = 'textarea';
|
3 |
const elementControlTargetUnicClass = `wptb-el-${infArr[1]}-${controlKey}`;
|
4 |
|
5 |
+
const allowedChildrenTags = [
|
6 |
+
'div',
|
7 |
+
'a',
|
8 |
+
'p',
|
9 |
+
'ul',
|
10 |
+
'li',
|
11 |
+
'ol',
|
12 |
+
'span',
|
13 |
+
'h1',
|
14 |
+
'h2',
|
15 |
+
'h3',
|
16 |
+
'h4',
|
17 |
+
'h5',
|
18 |
+
'center',
|
19 |
+
'iframe',
|
20 |
+
];
|
21 |
|
22 |
const innerChildTextArray = Array.from(allowedChildrenTags);
|
23 |
innerChildTextArray.push('#text');
|
inc/admin/element-classes/element-scripts/text-element.js
CHANGED
@@ -12,6 +12,10 @@ let tinyMceInitStart = function() {
|
|
12 |
fixed_toolbar_container: '#wpcd_fixed_toolbar',
|
13 |
paste_as_text: true,
|
14 |
toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
|
|
|
|
|
|
|
|
|
15 |
setup : function( ed ) {
|
16 |
ed.on( 'change', function(e) {
|
17 |
let row = WPTB_Helper.findAncestor( element, 'wptb-row' );
|
12 |
fixed_toolbar_container: '#wpcd_fixed_toolbar',
|
13 |
paste_as_text: true,
|
14 |
toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',
|
15 |
+
rel_list: [
|
16 |
+
{title: 'None', value: ''},
|
17 |
+
{title: 'nofollow', value: 'nofollow'}
|
18 |
+
],
|
19 |
setup : function( ed ) {
|
20 |
ed.on( 'change', function(e) {
|
21 |
let row = WPTB_Helper.findAncestor( element, 'wptb-row' );
|
inc/admin/element-classes/elements/button-element.php
CHANGED
@@ -203,7 +203,8 @@ class Button_Element extends Element_Base {
|
|
203 |
'min' => 1,
|
204 |
'max' => 3,
|
205 |
'step' => 0.1,
|
206 |
-
'defaultValue' => 1
|
|
|
207 |
]
|
208 |
];
|
209 |
|
@@ -211,10 +212,7 @@ class Button_Element extends Element_Base {
|
|
211 |
'buttonIcon' => [
|
212 |
'label' => __( 'Button Icon', $text_domain ),
|
213 |
'type' => Controls_Manager::ICON_SELECT,
|
214 |
-
'icons' => $this->
|
215 |
-
NS\WP_TABLE_BUILDER_URL,
|
216 |
-
'inc/frontend/views/icons'
|
217 |
-
] ) ),
|
218 |
'perPage' => 20,
|
219 |
'selectors' => [
|
220 |
[
|
@@ -224,16 +222,36 @@ class Button_Element extends Element_Base {
|
|
224 |
]
|
225 |
]
|
226 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
'iconPosition' => [
|
228 |
-
'label'
|
229 |
-
'type'
|
230 |
-
'
|
231 |
-
|
232 |
-
|
233 |
],
|
234 |
-
'selectors'
|
235 |
-
|
236 |
-
|
|
|
|
|
|
|
|
|
|
|
237 |
],
|
238 |
'iconSize' =>
|
239 |
[
|
@@ -271,16 +289,16 @@ class Button_Element extends Element_Base {
|
|
271 |
*/
|
272 |
protected function _content_template() {
|
273 |
?>
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
<?php
|
285 |
}
|
286 |
}
|
203 |
'min' => 1,
|
204 |
'max' => 3,
|
205 |
'step' => 0.1,
|
206 |
+
'defaultValue' => 1,
|
207 |
+
'postFix' => esc_html__( ' times', 'wp-table-builder' )
|
208 |
]
|
209 |
];
|
210 |
|
212 |
'buttonIcon' => [
|
213 |
'label' => __( 'Button Icon', $text_domain ),
|
214 |
'type' => Controls_Manager::ICON_SELECT,
|
215 |
+
'icons' => $this->read_icons(),
|
|
|
|
|
|
|
216 |
'perPage' => 20,
|
217 |
'selectors' => [
|
218 |
[
|
222 |
]
|
223 |
]
|
224 |
],
|
225 |
+
/**
|
226 |
+
* changed with new named toggle
|
227 |
+
* @deprecated
|
228 |
+
*/
|
229 |
+
// 'iconPosition' => [
|
230 |
+
// 'label' => __( 'Icon Position', $text_domain ),
|
231 |
+
// 'type' => Controls_Manager::SELECT,
|
232 |
+
// 'options' => [
|
233 |
+
// [ esc_html__( 'Left', $text_domain ), 'left', '' ],
|
234 |
+
// [ esc_html__( 'Right', $text_domain ), 'right', 'wptb-plugin-button-order-right' ],
|
235 |
+
// ],
|
236 |
+
// 'selectors' => [
|
237 |
+
// '{{{data.container}}} .wptb-button-wrapper a .wptb-button' => 'class'
|
238 |
+
// ]
|
239 |
+
// ],
|
240 |
'iconPosition' => [
|
241 |
+
'label' => esc_html__( 'Icon Position', 'wp-table-builder' ),
|
242 |
+
'type' => Controls_Manager::NAMED_TOGGLE,
|
243 |
+
'items' => [
|
244 |
+
'left' => esc_html__( 'left', 'wp-table-builder' ),
|
245 |
+
'right' => esc_html__( 'right', 'wp-table-builder' ),
|
246 |
],
|
247 |
+
'selectors' => [
|
248 |
+
[
|
249 |
+
'query' => '{{{data.container}}} .wptb-button-wrapper a .wptb-button',
|
250 |
+
'type' => Controls_Manager::CLASSTYPE,
|
251 |
+
'format' => 'wptb-plugin-button-order-{$}'
|
252 |
+
]
|
253 |
+
],
|
254 |
+
'defaultValue' => 'left'
|
255 |
],
|
256 |
'iconSize' =>
|
257 |
[
|
289 |
*/
|
290 |
protected function _content_template() {
|
291 |
?>
|
292 |
+
<div class="wptb-button-wrapper wptb-size-m">
|
293 |
+
<a>
|
294 |
+
<div class="wptb-button"
|
295 |
+
style="position: relative;">
|
296 |
+
<p>Button Text</p>
|
297 |
+
<div class="wptb-button-icon" data-wptb-button-icon-src="">
|
298 |
+
</div>
|
299 |
+
</div>
|
300 |
+
</a>
|
301 |
+
</div>
|
302 |
<?php
|
303 |
}
|
304 |
}
|
inc/admin/js/WPTB_BuilderControls.js
CHANGED
@@ -7,18 +7,21 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
7 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:["relativeElement","forceHide"],data:function(){return{listening:!1}},watch:{relativeElement:function(){this.relativeElement&&!this.listening&&(this.relativeElement.addEventListener("scroll",this.handleScroll),this.handleScroll(),this.listening=!0)}},methods:{handleScroll:function(){if(!this.forceHide){var e=this.relativeElement.scrollTop,t=this.$refs.observerElement.offsetTop;e+this.relativeElement.clientHeight>=t&&this.$emit("visible")}}}};exports.default=e;
|
8 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this.$createElement;return(this._self._c||e)("div",{ref:"observerElement"},[this._t("default")],2)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
9 |
},{}],"wvh1":[function(require,module,exports) {
|
10 |
-
"use strict";function e(e){return n(e)||a(e)||r(e)||t()}function t(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function
|
11 |
},{}],"LTB1":[function(require,module,exports) {
|
12 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../functions/selector"));function t(e){return e&&e.__esModule?e:{default:e}}var a={props:{label:String,selectors:{type:Array,required:!1,default:function(){return[]}},defaultValue:null,uniqueId:{type:String,required:!1,default:""},elemContainer:{type:String,required:!1,default:""}},data:function(){return{startupValue:null,targetElements:[],elementMainValue:"",mountedDataUpdate:!1}},mounted:function(){if(this.selectors.length>0){var t=e.default.getAllValues(this.selectors);this.targetElements=t.elements,this.startupValue=t.startupValue}},methods:{generateChangeEvent:function(e){var t=this;this.targetElements.map(function(a){a.elements.map(function(a){WPTB_Helper.wptbDocumentEventGenerate("wptb-control:".concat(t.uniqueId),a,{value:e})})})},assignDefaultValue:function(){void 0!==this.startupValue&&""!==this.startupValue&&null!==this.startupValue?(this.mountedDataUpdate=!0,this.elementMainValue=this.startupValue):null!==this.defaultValue&&(this.mountedDataUpdate=!0,this.elementMainValue=this.defaultValue)},setTargetValue:function(t,a){e.default.setTargetValue(t,a)},setAllValues:function(t){e.default.setAllValues(this.targetElements,t)},setTableDirty:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.mountedDataUpdate||(new WPTB_TableStateSaveManager).tableStateSet(),this.mountedDataUpdate=!1}}},u=a;exports.default=u;
|
13 |
},{"../functions/selector":"wvh1"}],"DTps":[function(require,module,exports) {
|
14 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("../components/IntersectionObserver")),t=n(require("../mixins/ControlBase"));function n(e){return e&&e.__esModule?e:{default:e}}var r={props:{label:String,icons:Object,perPage:{type:Number,default:20}},mixins:[t.default],components:{IntersectionObserver:e.default},data:function(){return{selectedIcon:{url:null,name:null},openDrawer:!1,innerDrawerRef:null,paginationIndex:1,observerHide:!1,debunkedFilterText:"",debunkId:-1,filterText:"",drawerPosition:{left:0}}},mounted:function(){var e=this;document.addEventListener("keyup",function(t){"Escape"===t.code&&e.openDrawer&&e.setDrawerState(!1)});var t=this.
|
15 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[i("div",{staticClass:"wptb-settings-space-between"},[i("p",{staticClass:"wptb-settings-item-title"},[e._v(e._s(e.label))]),e._v(" "),i("div",{staticClass:"wptb-icon-select-wrapper"},[i("div",{staticClass:"wptb-icon-select-display"},[i("div",{ref:"iconSelectButton",staticClass:"wptb-icon-select-preview",on:{click:e.toggleIconDrawer}},[i("img",{attrs:{src:e.selectedIcon.url}})]),e._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:e.openDrawer,expression:"openDrawer"}],staticClass:"wptb-icon-select-drawer wptb-plugin-box-shadow-md",style:e.drawerPosition},[i("div",{staticClass:"wptb-icon-search-wrapper"},[i("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.debunkedFilterText,expression:"debunkedFilterText",modifiers:{trim:!0}}],attrs:{type:"text",placeholder:"Search for icons..."},domProps:{value:e.debunkedFilterText},on:{input:function(t){t.target.composing||(e.debunkedFilterText=t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),i("div",{ref:"drawerRefElement",staticClass:"wptb-icon-previews"},[i("div",{staticClass:"wptb-icon-select-drawer-preview wptb-icon-reset",on:{click:function(t){return e.setIcon("","")}}}),e._v(" "),e._l(e.fullIconList(),function(t,s){return i("div",{key:s,staticClass:"wptb-icon-select-drawer-preview",class:{"wptb-icon-preview-active":e.selectedIcon.name===s}},[i("img",{attrs:{src:t,title:s,draggable:!1},on:{click:function(i){return e.setIcon(s,t)}}})])}),e._v(" "),i("intersection-observer",{attrs:{"relative-element":e.innerDrawerRef,"force-hide":e.observerHide},on:{visible:e.observerVisible}},[i("div",{staticClass:"wptb-icon-select-drawer-end"})])],2)])])])])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
16 |
},{"../components/IntersectionObserver":"WV0h","../mixins/ControlBase":"LTB1"}],"Pn7d":[function(require,module,exports) {
|
17 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("vue")),t=n(require("../functions/WPTB_ControlsManager")),o=n(require("../containers/IconSelectControl"));function n(e){return e&&e.__esModule?e:{default:e}}var r={name:"ControlIconSelect",handler:function(n){var r=t.default.getControlData(n);new e.default({data:r,components:{IconSelectControl:o.default}}).$mount("#".concat(n))}};exports.default=r;
|
18 |
-
},{"vue":"HYXJ","../functions/WPTB_ControlsManager":"WZJa","../containers/IconSelectControl":"DTps"}],"
|
19 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var
|
20 |
-
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,
|
21 |
-
},{
|
|
|
|
|
|
|
22 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=o(require("vue")),t=o(require("../containers/RangeControl")),n=o(require("../functions/WPTB_ControlsManager"));function o(e){return e&&e.__esModule?e:{default:e}}var r={name:"ControlRange",handler:function(o){var r=n.default.getControlData(o);new e.default({data:r,components:{RangeControl:t.default}}).$mount("#".concat(o))}};exports.default=r;
|
23 |
},{"vue":"HYXJ","../containers/RangeControl":"W4BN","../functions/WPTB_ControlsManager":"WZJa"}],"Y9Ty":[function(require,module,exports) {
|
24 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../mixins/ControlBase"));function t(e){return e&&e.__esModule?e:{default:e}}var s={props:{options:Object},mixins:[e.default],mounted:function(){this.assignDefaultValue()},watch:{elementMainValue:function(e){this.generateChangeEvent(e),this.setAllValues(e),this.setTableDirty(!0)}}};exports.default=s;
|
@@ -35,10 +38,7 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
35 |
},{}],"cW6v":[function(require,module,exports) {
|
36 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../functions/DeBouncer"));function t(e){return e&&e.__esModule?e:{default:e}}var i={props:{clone:{type:Boolean,default:!1,required:!1},cloneQuery:{type:String,required:!0},tableDirectives:{type:String,default:""},tableStyle:{type:Object,default:function(){}}},inheritAttrs:!1,data:function(){return{cloneInner:!1,clonedTable:null,mainTable:null,tableDirectiveDatasetId:"wptbResponsiveDirectives",tableHaveDirectives:!1}},mounted:function(){this.cloneInner=this.clone},watch:{clone:function(e){this.cloneInner=e},cloneInner:function(e){e&&(this.startClone(),this.cloneInner=!1)},tableDirectives:function(e){e&&this.addDirectivesToTable(e)},"appOptions.identifyCells":{handler:function(e){e&&(this.showCellIdentification(),this.appOptions.identifyCells=!1)}},"directives.responsiveEnabled":{handler:function(e){e&&(this.mainTable.dataset.wptbAdaptiveTable=0)}}},methods:{startClone:function(){if(this.mainTable=document.querySelector(this.cloneQuery),!this.mainTable)throw new Error("no clone target is found with a query value of ".concat(this.cloneQuery));this.appOptions.hasLegacyResponsive="1"===this.mainTable.dataset.wptbAdaptiveTable,this.clonedTable=this.mainTable.cloneNode(!0),this.clonedTable.classList.add("wptb-plugin-box-shadow-xl"),this.$refs.tableClone.appendChild(this.clonedTable);var e=this.mainTable.dataset[this.tableDirectiveDatasetId];this.tableDirectives&&this.addDirectivesToTable(this.tableDirectives),this.tableHaveDirectives=void 0!==e,this.setupCellIdentification(this.clonedTable),this.$emit("tableCloned",e)},addDirectivesToTable:function(e){this.clonedTable&&this.mainTable&&(this.clonedTable.dataset[this.tableDirectiveDatasetId]=e,this.mainTable.dataset[this.tableDirectiveDatasetId]=e,this.$emit("directivesCopied",this.tableHaveDirectives),this.tableHaveDirectives=!1)},setupCellIdentification:function(e){Array.from(e.querySelectorAll("td")).map(function(e,t){"relative"!==getComputedStyle(e).position&&(e.style.position="relative");var i=document.createRange();i.setStart(e,0);var a="background-color: hsla(211, 25%, ".concat(t%2==0?70:90,"%, 80%)"),n='<div class="wptb-responsive-cell-identifier" style="'.concat(a,'">').concat(t+1,"</div>"),l=i.createContextualFragment(n);e.appendChild(l.childNodes[0])})},showCellIdentification:function(){var t=this;this.clonedTable.classList.add("wptb-responsive-show-cell-identifier"),(0,e.default)("cellIdentification",function(){t.clonedTable.classList.remove("wptb-responsive-show-cell-identifier")},2e3)}}};exports.default=i;
|
37 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"wptb-responsive-clone-wrapper"},[t("div",{staticClass:"wptb-responsive-clone-inner-wrapper"},[t("div",{ref:"tableClone",style:this.tableStyle})])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
38 |
-
},{"../functions/DeBouncer":"qsi5"}],"
|
39 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={inheritAttrs:!1,props:{postFix:{type:String,default:""},value:{type:null,default:0},enableDynamicWidth:{type:Boolean,default:!1},dynamicWidthPadding:{type:Number,default:3},onlyEnter:{type:Boolean,default:!1},min:{type:Number,default:0},max:{type:Number,default:1e3},enableLimit:{type:Boolean,default:!1}},model:{prop:"value",event:"valueChanged"},watch:{value:function(t){this.innerValue=t}},data:function(){return{innerValue:0}},mounted:function(){this.innerValue=this.value},computed:{postFixIt:function(){return"".concat(this.innerValue).concat(this.postFix)},dynamicWidth:function(){return this.enableDynamicWidth?{width:"calc(".concat(this.innerValue.toString().length+this.postFix.length+this.dynamicWidthPadding,"ch) !important")}:{}}},methods:{getValue:function(t){var e=Number.parseInt(t,10);return e=isNaN(e)?0:e,this.enableLimit?this.limitValue(e):e},limitValue:function(t){return t<this.min?this.min:t>this.max?this.max:t},handleOnInput:function(t){this.onlyEnter||this.$emit("valueChanged",this.getValue(t.target.value))},handleEnterInput:function(t){this.onlyEnter&&this.$emit("valueChanged",this.getValue(t.target.value))},handleKeyPress:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"up",e=this.getValue(this.innerValue);switch(t){case"up":e+=1;break;case"down":e-=1;break;default:e+=1}e=this.getValue(e),this.$emit("valueChanged",e)}}};exports.default=t;
|
40 |
-
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,n=e.$createElement;return(e._self._c||n)("input",{style:e.dynamicWidth,attrs:{type:"text",disabled:e.$attrs.disabled},domProps:{value:e.postFixIt},on:{input:e.handleOnInput,keydown:[function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"up",38,n.key,["Up","ArrowUp"])?null:(n.preventDefault(),e.handleKeyPress("up"))},function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"down",40,n.key,["Down","ArrowDown"])?null:(n.preventDefault(),e.handleKeyPress("down"))},function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:(n.preventDefault(),e.handleEnterInput(n))}]}})},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
41 |
-
},{}],"xi3E":[function(require,module,exports) {
|
42 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=e(require("./NumberPostfixInput"));function e(t){return t&&t.__esModule?t:{default:t}}var a={props:{value:{type:Number,default:0},rawValue:{type:Number,default:0},active:{type:Boolean,default:!1},stopId:String,enableBreakpointCustomization:{type:Boolean,default:!1}},components:{NumberPostfixInput:t.default},data:function(){return{wrapperStyle:{left:0,top:0},innerRawValue:this.rawValue}},watch:{rawValue:function(t){this.innerRawValue=t},value:function(){this.calculateStyle()},innerRawValue:function(t){this.$emit("breakpointChange",t,this.stopId)}},mounted:function(){var t=this;this.$nextTick(function(){t.calculateStyle()})},methods:{clickEvent:function(){this.$emit("click",this.rawValue)},calculateStyle:function(){var t=this.$refs.wrapper,e=this.$refs.knob;if(t){var a=t.getBoundingClientRect().width;this.wrapperStyle.left="calc(".concat(this.value,"% - ").concat(a/2,"px)")}if(e){var n=e.getBoundingClientRect().height;this.wrapperStyle.top="-".concat(n/2,"px")}}}};exports.default=a;
|
43 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"wrapper",staticClass:"wptb-slider-stop",class:{"wptb-slider-stop-active":e.active},style:e.wrapperStyle,on:{"!click":function(t){return t.preventDefault(),e.clickEvent(t)}}},[i("div",{ref:"knob",staticClass:"wptb-slider-stop-knob"}),e._v(" "),i("div",{staticClass:"wptb-slider-stop-label"},[e._t("default")],2),e._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:e.enableBreakpointCustomization,expression:"enableBreakpointCustomization"}]},[i("number-postfix-input",{staticClass:"wptb-size-input",staticStyle:{"font-size":"90%"},attrs:{"enable-dynamic-width":!0,"only-enter":!0,"post-fix":"px"},model:{value:e.innerRawValue,callback:function(t){e.innerRawValue=t},expression:"innerRawValue"}})],1)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
44 |
},{"./NumberPostfixInput":"h0P7"}],"ooD9":[function(require,module,exports) {
|
@@ -48,15 +48,15 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
48 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{positionPercentage:{type:Number,default:0}},data:function(){return{style:{left:0}}},watch:{positionPercentage:{handler:function(){this.calculateStyle()},deep:!0}},mounted:function(){this.calculateStyle()},methods:{calculateStyle:function(){var e=this.$refs.arrowWrapper.getBoundingClientRect().width;this.style.left="calc(".concat(this.positionPercentage,"% - ").concat(e/2,"px)")},handleDrag:function(e){var t=e.screenX,a=e.screenY;0===t&&0===a||this.$emit("arrowDrag",e)}}};exports.default=e;
|
49 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{ref:"arrowWrapper",staticClass:"wptb-screen-size-slider-arrow",style:e.style,attrs:{draggable:"true"},on:{drag:function(t){return t.preventDefault(),e.handleDrag(t)},dragover:function(e){e.preventDefault()},dragend:function(t){return t.preventDefault(),e.$emit("arrowDragEnd")},drop:function(e){e.preventDefault()},dragexit:function(e){e.preventDefault()},dragleave:function(e){e.preventDefault()}}},[r("svg",{attrs:{width:"17",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"}},[r("path",{attrs:{d:"M8.5 16L0 0h17L8.5 16z",fill:"var(--wptb-plugin-logo-color)"}})])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
50 |
},{}],"V4gv":[function(require,module,exports) {
|
51 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=n(require("./SliderStop")),e=n(require("./SliderFill")),i=n(require("./SliderArrow"));function n(t){return t&&t.__esModule?t:{default:t}}var r={props:{stops:Object,endPadding:{type:Number,default:0},modelVal:{type:Number,default:0},enableBreakpointCustomization:{type:Boolean,default:!1}},components:{SliderStop:t.default,SliderFill:e.default,SliderArrow:i.default},data:function(){return{min:0,max:100,currentVal:0,isDragging:!1,minSizeBetweenBreakpoints:100,repaintId:0}},beforeMount:function(){this.calculateMinMax()},watch:{currentVal:function(){this.$emit("slide",this.currentVal)},modelVal:function(t){this.currentVal=Math.floor(t)}},methods:{handleBreakpointChange:function(t,e){var i=this.directives.breakpoints;if(!i[e])throw new Error("no breakpoint found with the given ID: [".concat(e,"]"));var n=Object.keys(i).sort(function(t,e){return i[t].width-i[e].width}),r=n.indexOf(e),a=n[r-1],s=n[r+1];a&&i[a].width>=t&&(t=i[a].width+this.minSizeBetweenBreakpoints),s&&i[s].width<=t&&(t=i[s].width-this.minSizeBetweenBreakpoints),i[e].width=t,this.calculateMinMax(),this.repaintId+=1},calculateMinMax:function(){var t=Object.values(this.stops).sort(function(t,e){return-1*(e.width-t.width)});this.min=t[0].width-this.endPadding,this.max=t[t.length-1].width+this.endPadding,this.currentVal=t[t.length-1].width},translateIntoPercent:function(t){var e=this.max-this.min;return 100*(t-this.min)/e},slide:function(t){this.currentVal=t},handleArrowDrag:function(t){this.isDragging=!0;var e=this.$refs.sliderWrapper.getBoundingClientRect(),i=e.left,n=e.width,r=(t.clientX-i)*(this.max-this.min)/n;this.currentVal=this.limitToRange(this.min+r)},limitToRange:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t;return t<this.min&&(i=this.min),t>this.max&&(i=this.max),e&&(i=Math.floor(i)),i},isStopActive:function(t){var e=this;return this.currentVal>=t&&Object.values(this.stops).filter(function(t){return t<=e.currentVal}).every(function(e){return e<=t})}}};exports.default=r;
|
52 |
-
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{key:e.repaintId,ref:"sliderWrapper",staticClass:"wptb-screen-size-slider-wrapper",class:{"wptb-drag-active":e.isDragging}},[r("div",{staticClass:"wptb-screen-size-slider-empty"},[r("slider-arrow",{attrs:{"position-percentage":e.translateIntoPercent(e.limitToRange(e.currentVal))},on:{arrowDrag:e.handleArrowDrag,arrowDragEnd:function(t){e.isDragging=!1}}}),e._v(" "),r("slider-fill",{attrs:{amount:e.translateIntoPercent(e.limitToRange(e.currentVal))}}),e._v(" "),e._l(e.stops,function(t,a){var n=t.name,i=t.width;return r("slider-stop",{key:a,attrs:{active:e.isStopActive(i),value:e.translateIntoPercent(i),"raw-value":i,"stop-id":a,enableBreakpointCustomization:e.enableBreakpointCustomization},on:{click:e.slide,breakpointChange:e.handleBreakpointChange}},[e._v(e._s(n))])})],2)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
53 |
},{"./SliderStop":"xi3E","./SliderFill":"ooD9","./SliderArrow":"q8F8"}],"phKF":[function(require,module,exports) {
|
54 |
|
55 |
var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};
|
56 |
},{}],"Q6f0":[function(require,module,exports) {
|
57 |
var global = arguments[3];
|
58 |
var process = require("process");
|
59 |
-
var e=arguments[3],t=require("process");function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){o(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return(a="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})(e)}!function(e,t,n){"object"===("undefined"==typeof exports?"undefined":a(exports))&&"undefined"!=typeof module?module.exports=n():t[e]=n()}("WPTB_ResponsiveFrontend",self||e,function(){function e(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]}function t(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.element=e,this.referenceObject=n,this.mergedRenderStatus=!0,this.mergedCells={row:[],column:[]},this.getMergedRenderStatus=function(){return t.mergedRenderStatus},this.setMergedRenderStatus=function(e){t.mergedRenderStatus=e},this.addToMergedCells=function(e,n){t.mergedCells[e].push(n)},this.isReference=function(){return null!==t.referenceObject},this.isReference()&&(this.element=e.cloneNode(!0)),this.modifications={},this.spans={row:1,col:1},this.remainingSpans={row:0,col:0},this.cacheSpanValues=function(){Object.keys(t.spans).map(function(e){if(Object.prototype.hasOwnProperty.call(t.spans,e)){var n=t.spans[e];t.spans[e]=t.element.getAttribute("".concat(e,"Span"))||n}})},this.cacheSpanValues(),this.getSpan=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?t.getElement().getAttribute("".concat(e,"Span")):t.spans[e];if(n)return n;throw new Error("no span value found with the given type of [".concat(e,"]"))},this.getRemainingSpans=function(e){return t.remainingSpans[e]},this.setRemainingSpans=function(e,n){t.remainingSpans[e]=n},this.getElement=function(){return t.element},this.createCellElement=function(){return document.createElement("td")},e||(this.element=this.createCellElement()),this.setAttribute=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:",",s=t.getElement()[e];"function"!=typeof s&&"object"!==a(s)||(s=t.getElement().getAttribute(e)),t.modifications[e]&&(s=t.modifications[e].default);var i=s;r?i+="".concat(i).concat(o).concat(n):i=n,t.modifications[e]={value:i,default:s},t.getElement()[e]=i},this.setSpan=function(e,n){if(!t.isReference()){var r=t.getSpan(e)-n<0?t.getSpan(e):n;t.setAttribute("".concat(e,"Span"),r),t.setRemainingSpans(e,t.getSpan(e)-r);for(var o=0;o<r-1;o+=1)t.mergedCells[e]&&t.mergedCells[e][o]&&t.mergedCells[e][o].setMergedRenderStatus(!1);return!0}if(!t.getMergedRenderStatus())return!1;var a=t.referenceObject.getRemainingSpans(e);if(0===a)return!1;var s=a-n<0?a:n,i=a-s;if(t.referenceObject.setRemainingSpans(e,i),t.setAttribute("".concat(e,"Span"),s),0!==i)for(var l=t.referenceObject.mergedCells[e].length-a+1,d=l+s-1,u=l;u<d;u+=1)t.mergedCells[e][u].setMergedRenderStatus(!1);return!0},this.resetAttribute=function(e){t.modifications[e]&&(t.getElement()[e]=t.modifications[e].default,t.modifications[e]=void 0)},this.resetAllAttributes=function(){Object.keys(t.modifications).map(function(e){Object.prototype.hasOwnProperty.call(t.modifications,e)&&t.resetAttribute(e)})},{getElement:this.getElement,el:this.element,setAttribute:this.setAttribute,resetAllAttributes:this.resetAllAttributes,getSpan:this.getSpan,setSpan:this.setSpan,getRemainingSpans:this.getRemainingSpans,setRemainingSpans:this.setRemainingSpans,isReference:this.isReference,addToMergedCells:this.addToMergedCells,mergedCells:this.mergedCells,setMergedRenderStatus:this.setMergedRenderStatus,getMergedRenderStatus:this.getMergedRenderStatus}}function n(n){var r=this;return this.tableElement=n,this.parsedTable=[],this.rowCache=[],this.originals={rows:[]},this.rowColors={header:null,even:null,odd:null},this.addToParsed=function(e,t,n){r.parsedTable[e]||(r.parsedTable[e]=[]),r.parsedTable[e][t]=n},this.parseTable=function(){var e=Array.from(r.tableElement.querySelectorAll("tr"));e.map(function(e,n){r.originals.rows.push(e),Array.from(e.querySelectorAll("td")).map(function(e,o){var a=new t(e);r.addToParsed(n,o,a);var s=a.getSpan(t.spanTypes.row),i=a.getSpan(t.spanTypes.column);if(s>1)for(var l=1;l<s;l+=1){var d=new t(e,a);a.addToMergedCells("row",d),r.addToParsed(n+l,o,d)}if(i>1)for(var u=1;u<i;u+=1){var c=new t(e,a);a.addToMergedCells("column",c),r.addToParsed(n,o+u,c)}})}),r.parseRowColors(e)},this.parseRowColors=function(t){(!t||t.length<=0)&&e("no rows are found to parse their colors","error");var n=r.tableElement.dataset.wptbHeaderBackgroundColor,o=r.tableElement.dataset.wptbEvenRowBackgroundColor,a=r.tableElement.dataset.wptbOddRowBackgroundColor;r.rowColors.header=void 0!==n?n:""===t[0].style.backgroundColor?null:t[0].style.backgroundColor;for(var s=t.length/3>=1?0:1===t.length?2:(t.length-1)%2,i=0;i<s;i+=1){var l=document.createElement("tr");r.tableElement.querySelector("tbody").appendChild(l),t.push(l)}r.rowColors.even=o||getComputedStyle(t[1]).backgroundColor,r.rowColors.odd=o?a:getComputedStyle(t[2]).backgroundColor;for(var d=0;d<s;d+=1)t[t.length-(d+1)].remove()},this.addRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;Array.isArray(e)||(e=[e]);var o,a=r.tableElement.querySelector("tbody");if(t)o=r.originals.rows[n];else{var s=document.createRange();s.setStart(a,0),o=s.createContextualFragment('<tr class="'.concat(e.join(" "),'"></tr>')).childNodes[0]}return a.appendChild(o),r.rowCache.push(o),{el:o,id:r.rowCache.length-1}},this.clearTable=function(){r.rowCache=[],r.tableElement.querySelector("tbody").innerHTML=""},this.getRow=function(t){return r.rowCache[t]?r.rowCache[t]:(e("no row with id [".concat(t,"] found in the cache."),"warn"),null)},this.maxRows=function(){return r.parsedTable.length},this.maxColumns=function(){return r.parsedTable.reduce(function(e,t){return t.length>e&&(e=t.length),e},0)},this.getCell=function(t,n){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{if(r.parsedTable[t][n])return o?r.parsedTable[t][n]:r.parsedTable[t][n].el}catch(a){return e("no cell found at the given address of [".concat(t,"-").concat(n,"]"),"warn"),null}return e("no cell found at the given address of [".concat(t,"-").concat(n,"]"),"warn"),null},this.getCellsAtRow=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],o=0;o<r.maxColumns();o+=1){var a=r.getCell(e,o,t);a&&n.push(a)}return n},this.appendToRow=function(e,t,n){var o=r.getRow(n),a=r.getCell(e,t,!0);return a&&o&&o.appendChild(a.getElement()),a},this.appendElementToRow=function(e,t){var n=r.getRow(t);e&&n&&n.appendChild(e)},this.appendObjectToRow=function(e,t){var n=r.getRow(t);e&&n&&n.appendChild(e.getElement())},this.parseTable(),{maxRows:this.maxRows,maxColumns:this.maxColumns,addRow:this.addRow,clearTable:this.clearTable,getCell:this.getCell,appendToRow:this.appendToRow,appendElementToRow:this.appendElementToRow,appendObjectToRow:this.appendObjectToRow,getCellsAtRow:this.getCellsAtRow,el:this.tableElement,rowColors:this.rowColors}}t.spanTypes={row:"row",column:"col"};var o={query:".wptb-preview-table",defaultClasses:["wptb-plugin-responsive-base"],bindToResize:!1};return function(){var e=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.options=r({},o,{},a),this.elements=Array.from(document.querySelectorAll(this.options.query)),this.elementObjects=this.elements.map(function(e){return{el:e,tableObject:new n(e)}}),this.bindRebuildToResize=function(){window.addEventListener("resize",function(t){e.rebuildTables(t.target.innerWidth)})},this.getDirective=function(e){var t=e.dataset.wptbResponsiveDirectives;return t?JSON.parse(atob(t)):null},this.addDefaultClasses=function(t){t.classList.add(e.options.defaultClasses)},this.removeDefaultClasses=function(t){t.classList.remove(e.options.defaultClasses)},this.autoBuild=function(t,n,r,o){var a=r.cellStackDirection[n],s=r.topRowAsHeader[n],i=r.cellsPerRow[n],l=!!r.staticTopRow&&r.staticTopRow[n];o.clearTable(),"desktop"===n?(e.buildDefault(o),e.removeDefaultClasses(t)):(e.autoDirectionBuild(o,a,s,l,i),e.addDefaultClasses(t))},this.autoDirectionBuild=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=t.maxRows(),i=t.maxColumns(),l="row"===n;if(r)e.headerBuild(t,n,a);else if(l)!function(){var e=[],n=0;o&&t.getCellsAtRow(0,!0).filter(function(e){return!e.isReference()}).map(function(e){n+=1;var r=t.addRow("wptb-row");r.el.style.backgroundColor=t.rowColors.header,t.appendObjectToRow(e,r.id),e.setAttribute("colSpan",a)});for(var r=n;r<s;r+=1)t.getCellsAtRow(r,!0).forEach(function(t){return e.push(t)});for(var i=e.length,l=0,d=0;l<i;l+=a,d+=1){var u=t.addRow("wptb-row");u.el.style.backgroundColor=t.rowColors[d%2==0?"odd":"even"];for(var c=0;c<a;c+=1){var p=e[l+c];p&&(t.appendElementToRow(p.getElement(),u.id),p.resetAllAttributes(),p.setAttribute("style","width: 100% !important",!0,";"),p.setAttribute("colSpan",1),p.setAttribute("rowSpan",1))}}}();else{var d=[],u=0;o&&t.getCellsAtRow(0,!0).filter(function(e){return!e.isReference()}).map(function(e){u+=1;var n=t.addRow("wptb-row");n.el.style.backgroundColor=t.rowColors.header,t.appendObjectToRow(e,n.id),e.setAttribute("colSpan",a)});for(var c=0;c<i;c+=1)for(var p=u;p<s;p+=1){var f=t.getCell(p,c,!0);f&&d.push(f)}for(var h=d.length,g=0,b=0;g<h;g+=a,b+=1){var m=t.addRow("wptb-row");m.el.style.backgroundColor=t.rowColors[b%2==0?"odd":"even"];for(var w=0;w<a;w+=1){var v=d[g+w];v&&(t.appendElementToRow(v.getElement(),m.id),v.resetAllAttributes(),v.setAttribute("style","width: 100% !important",!0,";"),v.setAttribute("colSpan",1),v.setAttribute("rowSpan",1))}}}},this.headerBuild=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=e.getCellsAtRow(0,!0).map(function(t){return t.setAttribute("style","background-color: ".concat(e.rowColors.header),!0,";"),t}),a="column"===n,s=e.maxRows(),i=e.maxColumns();if(a)for(var l=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=e.addRow("wptb-row");t&&(n.el.style.borderTop="3px solid gray"),o.map(function(t){e.appendElementToRow(t.el.cloneNode(!0),n.id)})},d=Math.ceil((s-1)/r),u=1,c=0;c<d;c+=1){l(c>0);for(var p=0;p<r&&!(u>=s);p+=1){var f=e.addRow("wptb-row");f.el.style.backgroundColor=e.rowColors[p%2==0?"even":"odd"];for(var h=0;h<i;h+=1){var g=e.getCell(u,h,!0);if(g){g.resetAllAttributes();var b=!0,m=g.getSpan(t.spanTypes.row);if(g.getSpan(t.spanTypes.column),m>1){var w=r-p,v=Math.min(m,w);b=g.setSpan(t.spanTypes.row,v),g.setMergedRenderStatus(!0)}b&&e.appendObjectToRow(g,f.id)}}u+=1}}else for(var R=Math.ceil((s-1)/r),C=1,y=0;y<R;y+=1){for(var S=0;S<i;S+=1){var T=e.addRow("wptb-row");T.el.style.backgroundColor="none",y>0&&0===S&&(T.el.style.borderTop="3px solid gray");var A=o[S].el.cloneNode(!0);A.style.backgroundColor="".concat(e.rowColors.header," !important"),e.appendElementToRow(A,T.id);for(var O=0;O<r&&!(C+O>=s);O+=1){var E=e.getCell(C+O,S,!0);if(E){E.resetAllAttributes();var j=!0,k=E.getSpan(t.spanTypes.row);if(E.getSpan(t.spanTypes.column),k>1){var M=r-O,x=Math.min(k,M);j=E.setSpan(t.spanTypes.row,x);var P=E.el.getAttribute("rowSpan"),D=E.el.getAttribute("colSpan");E.setAttribute("rowSpan",D),E.setAttribute("colSpan",P),E.setMergedRenderStatus(!0)}if(j){var B=(C+O+y)%2==0?"even":"odd";1===r&&(B=C%2==0?"even":"odd"),E.setAttribute("style","background-color: ".concat(e.rowColors[B]),!0,";"),e.appendObjectToRow(E,T.id)}}}}C+=r}},this.buildDefault=function(e){for(var t=e.maxRows(),n=e.maxColumns(),r=0;r<t;r+=1)for(var o=e.addRow("",!0,r).id,a=0;a<n;a+=1){var s=e.getCell(r,a,!0);s&&!s.isReference()&&(s.resetAllAttributes(),e.appendElementToRow(s.getElement(),o))}},this.calculateRangeId=function(e,t){var n=Object.keys(t).sort(function(e,n){return t[e].width-t[n].width}),r=n[0];return n.map(function(n){e>=t[n].width&&(r=n)}),r},this.rebuildTable=function(t,n,r){var o=e.getDirective(t);if(o){if(!o.responsiveEnabled)return;var a=o.responsiveMode,s=e["".concat(a,"Build")];n||(n=t.getBoundingClientRect().width);var i=e.calculateRangeId(n,o.breakpoints);if(!s)throw new Error("No build mode named as [".concat(a,"] found."));var l=o.modeOptions[a];s.call(e,t,i,l,r)}},this.rebuildTables=function(t){t||(t=window.innerWidth),e.elementObjects.map(function(n){e.rebuildTable(n.el,t,n.tableObject)})},this.options.bindToResize&&this.bindRebuildToResize(),{rebuildTables:this.rebuildTables}}});
|
60 |
},{"process":"phKF"}],"ATQh":[function(require,module,exports) {
|
61 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={props:{click:{type:Function,default:function(){console.log("Material button clicked")}},size:{type:String,default:"fit-content"}},computed:{buttonClass:function(){return["wptb-plugin-button-material-".concat(this.size)]}}};exports.default=t;
|
62 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"wptb-plugin-button-material",class:t.buttonClass,on:{click:function(e){return e.preventDefault(),t.click(e)}}},[t._t("default")],2)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
@@ -85,7 +85,7 @@ var e=arguments[3],t=require("process");function n(e,t){var n=Object.keys(e);if(
|
|
85 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"wptb-element-option wptb-settings-items wptb-plugin-width-full"},[n("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[n("label",{staticClass:"wptb-control-row wptb-flex wptb-flex-row wptb-flex-align-center wptb-flex-justify-space-between"},[n("span",{staticStyle:{"font-size":"16px"}},[e._v(" "+e._s(e.label)+" ")]),e._v(" "),n("select",{directives:[{name:"model",rawName:"v-model",value:e.innerValue,expression:"innerValue"}],attrs:{disabled:e.disabled},on:{change:function(t){var n=Array.prototype.filter.call(t.target.options,function(e){return e.selected}).map(function(e){return"_value"in e?e._value:e.value});e.innerValue=t.target.multiple?n:n[0]}}},e._l(e.options,function(t,l){return n("option",{key:l,domProps:{value:l}},[e._v(e._s(e._f("cap")(t)))])}),0)])])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
86 |
},{"../mixins/PanelControlBase":"vpWQ"}],"DmVJ":[function(require,module,exports) {
|
87 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("vue-fragment"),r=t(require("./PanelToggleControl")),o=t(require("./PanelDropdownControl"));function t(e){return e&&e.__esModule?e:{default:e}}var n={components:{PanelToggleControl:r.default,PanelDropdownControl:o.default,Fragment:e.Fragment}};exports.default=n;
|
88 |
-
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,
|
89 |
},{"vue-fragment":"CDb8","./PanelToggleControl":"osOD","./PanelDropdownControl":"fI53"}],"UchZ":[function(require,module,exports) {
|
90 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{header:{type:String,default:"Tab Header"},tabs:{type:Object,default:function(){return{default:"Default"}}},currentTab:{type:String,default:"default"}},methods:{isActiveTab:function(e){return this.currentTab===e},handleTabClick:function(e){this.$emit("tabClicked",e)}}};exports.default=e;
|
91 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"wptb-section-group-tabbed wptb-plugin-box-shadow-md wptb-plugin-width-full"},[s("div",{staticClass:"wptb-panel-toggle wptb-section-group-tabbed-header"},[s("div",{staticClass:"header"},[t._v(t._s(t.header))])]),t._v(" "),s("div",{staticClass:"wptb-section-group-tabbed-tabs-buttons"},t._l(t.tabs,function(e,i){return s("div",{key:i,staticClass:"wptb-settings-section-item static-active",class:{active:t.isActiveTab(i),disabled:!t.isActiveTab(i)},on:{"!click":function(e){return e.preventDefault(),t.handleTabClick(i)}}},[t._v(" "+t._s(e)+" ")])}),0),t._v(" "),s("div",{staticClass:"wptb-section-group-tab-content"},[t._t("default")],2)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
@@ -99,7 +99,7 @@ var e=arguments[3],t=require("process");function n(e,t){var n=Object.keys(e);if(
|
|
99 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("./PanelSectionGroupTabbed")),t=r(require("./AutoModePanelControls"));function r(e){return e&&e.__esModule?e:{default:e}}var o={components:{PanelSectionGroupTabbed:e.default,AutoModePanelControls:t.default},computed:{breakpointsObject:function(){var e=this;return Object.keys(this.directives.breakpoints).sort(function(t,r){return e.directives.breakpoints[t].width-e.directives.breakpoints[r].width}).reduce(function(t,r){return Object.prototype.hasOwnProperty.call(e.directives.breakpoints,r)&&(t[r]=e.directives.breakpoints[r].name),t},{})},currentPanelControls:function(){return"".concat(this.directives.responsiveMode[0].toUpperCase()+this.directives.responsiveMode.slice(1),"ModePanelControls")}},methods:{handleTabChange:function(e){this.appOptions.currentBreakpoint=e,this.appOptions.currentSize=this.directives.breakpoints[e].width}}};exports.default=o;
|
100 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this.$createElement,e=this._self._c||t;return e("panel-section-group-tabbed",{attrs:{"current-tab":this.appOptions.currentBreakpoint,tabs:this.breakpointsObject,header:this.strings[this.directives.responsiveMode]},on:{tabClicked:this.handleTabChange}},[e(this.currentPanelControls,{tag:"component"})],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
101 |
},{"./PanelSectionGroupTabbed":"UchZ","./AutoModePanelControls":"rfRR"}],"Ub7O":[function(require,module,exports) {
|
102 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=l(require("vue")),t=l(require("../containers/ResponsiveApp")),n=l(require("../components/ResponsiveControlsRow")),o=l(require("../functions/WPTB_ControlsManager")),r=l(require("../plugins/filters")),s=l(require("../plugins/strings")),a=l(require("../components/ResponsivePanelGeneralControls")),i=l(require("../components/ResponsivePanelModeControls"));function l(e){return e&&e.__esModule?e:{default:e}}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d={name:"ResponsiveTable",handler:function(l){var p=o.default.getControlData("responsiveMenuData"),c={responsiveEnabled:!1,responsiveMode:"auto",preserveRowColor:!1,modeOptions:{auto:{topRowAsHeader:{desktop:!1,tablet:!1,mobile:!1},staticTopRow:{desktop:!1,tablet:!1,mobile:!1},cellStackDirection:{desktop:"row",tablet:"row",mobile:"row"},cellsPerRow:{desktop:1,tablet:1,mobile:1}}},breakpoints:p.screenSizes};e.default.use({install:function(e,t){var n=t.components;e.mixin({components:n})}},{components:{ResponsiveControlsRow:n.default}}),e.default.use({install:function(e,t){e.mixin({data:function(){return t.data}})}},{data:{appOptions:{identifyCells:!1,hasLegacyResponsive:!1,currentBreakpoint:"desktop",currentSize:0},directives:c}}),e.default.use(r.default),e.default.use(s.default,p),new e.default({components:{ResponsiveApp:t.default},data:u({mainTableQuery:".wptb-preview-table"},p),template:'<responsive-app :clone-query="mainTableQuery" :screen-sizes="screenSizes" :compare-sizes="compareSizes"></responsive-app>'}).$mount("#".concat(l)),new e.default({components:{ResponsivePanelGeneralControls:a.default},template:"<responsive-panel-general-controls></responsive-panel-general-controls>"}).$mount("#responsiveBuilderLeftPanelGeneralControls"),new e.default({components:{ResponsivePanelModeControls:i.default},data:u({},p),template:"<responsive-panel-mode-controls></responsive-panel-mode-controls>"}).$mount("#responsiveBuilderLeftPanelModeOptions")}};exports.default=d;
|
103 |
},{"vue":"HYXJ","../containers/ResponsiveApp":"waBm","../components/ResponsiveControlsRow":"TuCQ","../functions/WPTB_ControlsManager":"WZJa","../plugins/filters":"GZC0","../plugins/strings":"yEip","../components/ResponsivePanelGeneralControls":"DmVJ","../components/ResponsivePanelModeControls":"BxO6"}],"n7p4":[function(require,module,exports) {
|
104 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{label:{type:String,default:"top"},value:{type:Number,default:0},disabled:{type:Boolean,default:!1}},model:{prop:"value",event:"valueChanged"},mounted:function(){this.innerValue=this.value},data:function(){return{innerValue:0}},watch:{value:function(e){this.innerValue=e},innerValue:function(e){this.$emit("valueChanged",Number.parseInt(e,10))}},methods:{inputChange:function(e){this.$emit("changedFromFront",this.$vnode.key,e.target.value),this.innerValue=e.target.value}}};exports.default=e;
|
105 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"wptb-side-control-input-wrapper wptb-side-control-number-input"},[n("div",{staticClass:"wptb-side-control-header"},[t._v(" "+t._s(t._f("cap")(t.label))+" ")]),t._v(" "),n("div",[n("input",{staticClass:"wptb-side-control-main-input",attrs:{type:"number",disabled:t.disabled},domProps:{value:t.innerValue},on:{input:t.inputChange}})])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
@@ -107,11 +107,22 @@ var e=arguments[3],t=require("process");function n(e,t){var n=Object.keys(e);if(
|
|
107 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{value:{type:String,default:"px"}},model:{prop:"value",event:"valueChanged"},data:function(){return{options:["px","%"],innerValue:""}},mounted:function(){this.innerValue=this.value},watch:{value:function(e){this.innerValue=e},innerValue:function(e){this.$emit("valueChanged",e)}},methods:{isSelected:function(e){return this.innerValue===e}}};exports.default=e;
|
108 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"wptb-side-control-input-wrapper wptb-side-control-dropdown-wrapper"},[n("select",{directives:[{name:"model",rawName:"v-model",value:e.innerValue,expression:"innerValue"}],staticClass:"wptb-side-control-main-input wptb-side-control-dropdown",on:{change:function(t){var n=Array.prototype.filter.call(t.target.options,function(e){return e.selected}).map(function(e){return"_value"in e?e._value:e.value});e.innerValue=t.target.multiple?n:n[0]}}},e._l(e.options,function(t){return n("option",{key:t,domProps:{value:t,selected:e.isSelected(t)}},[e._v(e._s(t))])}),0)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
109 |
},{}],"ouPJ":[function(require,module,exports) {
|
110 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("../mixins/ControlBase")),t=n(require("../components/SideInput")),i=n(require("../components/SideDropdown"));function n(e){return e&&e.__esModule?e:{default:e}}function
|
111 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,s=e.$createElement,t=e._self._c||s;return t("div",[t("div",{staticClass:"wptb-settings-item-header-include-right"},[t("div",{staticClass:"wptb-settings-space-between"},[t("div",[e._v(e._s(e._f("cap")(e.label)))]),e._v(" "),t("div",{on:{click:function(s){s.preventDefault(),e.linkValues=!e.linkValues}}},[e.linkValues?t("div",{staticClass:"wptb-sides-link-icon-wrapper"},[t("img",{attrs:{src:e.unlinkIcon,title:e.strings.unlink}})]):t("div",{staticClass:"wptb-sides-link-icon-wrapper"},[t("img",{attrs:{src:e.linkIcon,title:e.strings.link}})])])])]),e._v(" "),t("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs wptb-sides-controls-wrapper",class:{"wptb-side-values-linked":e.linkValues}},[e._l(e.sideValues,function(s,i){return t("side-input",{key:i,attrs:{label:e.strings[i]},on:{changedFromFront:e.inputChanged},model:{value:e.sideValues[i],callback:function(s){e.$set(e.sideValues,i,s)},expression:"sideValues[k]"}})}),e._v(" "),t("side-dropdown",{model:{value:e.type,callback:function(s){e.type=s},expression:"type"}})],2)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
112 |
},{"../mixins/ControlBase":"LTB1","../components/SideInput":"n7p4","../components/SideDropdown":"VsoX"}],"Qbmt":[function(require,module,exports) {
|
113 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("vue")),t=n(require("../functions/WPTB_ControlsManager")),r=n(require("../containers/SidesControl")),o=n(require("../plugins/filters"));function n(e){return e&&e.__esModule?e:{default:e}}var u={name:"ControlSides",handler:function(n){var u=t.default.getControlData(n);e.default.use(o.default),new e.default({data:u,components:{SidesControl:r.default}}).$mount("#".concat(n))}};exports.default=u;
|
114 |
-
},{"vue":"HYXJ","../functions/WPTB_ControlsManager":"WZJa","../containers/SidesControl":"ouPJ","../plugins/filters":"GZC0"}],"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
-
"use strict";var e=
|
117 |
-
},{"vue":"HYXJ","./mountPoints/WPTB_IconSelectControl":"Pn7d","./mountPoints/WPTB_RangeControl":"YVYX","./mountPoints/WPTB_Select2Control":"eNVe","./mountPoints/WPTB_MediaSelectControl":"Uwhc","./functions/WPTB_ControlsManager":"WZJa","./mountPoints/WPTB_ResponsiveTable":"Ub7O","./mountPoints/WPTB_SidesControl":"Qbmt"}]},{},["Zn1h"], null)
|
7 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:["relativeElement","forceHide"],data:function(){return{listening:!1}},watch:{relativeElement:function(){this.relativeElement&&!this.listening&&(this.relativeElement.addEventListener("scroll",this.handleScroll),this.handleScroll(),this.listening=!0)}},methods:{handleScroll:function(){if(!this.forceHide){var e=this.relativeElement.scrollTop,t=this.$refs.observerElement.offsetTop;e+this.relativeElement.clientHeight>=t&&this.$emit("visible")}}}};exports.default=e;
|
8 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this.$createElement;return(this._self._c||e)("div",{ref:"observerElement"},[this._t("default")],2)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
9 |
},{}],"wvh1":[function(require,module,exports) {
|
10 |
+
"use strict";function e(e,a){return n(e)||r(e,a)||u(e,a)||t()}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var l,u=e[Symbol.iterator]();!(n=(l=u.next()).done)&&(r.push(l.value),!t||r.length!==t);n=!0);}catch(i){a=!0,o=i}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}}function n(e){if(Array.isArray(e))return e}function a(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=u(e))){var t=0,r=function(){};return{s:r,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,a,o=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(l)throw a}}}}function o(e){return s(e)||i(e)||u(e)||l()}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function i(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function s(e){if(Array.isArray(e))return c(e)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t){var r=null;switch(t){case"dataset":r=e.dataset;break;case"style":r=e.style;break;case"class":r="class";break;default:r=e.dataset}return r}function y(e){var t=e.query,r=e.type,n=e.key,a=e.format,l=o(document.querySelectorAll(t));if(l.length>0){var u=f(l[0],r);if(u){var i;if(i="class"===u?l[0].getAttribute("class"):u[n],a){var s,c=a.replace("{$}","(.+)"),y=new RegExp("^".concat(c,"$"),"g");"class"===u?i.split(" ").some(function(e){var t=y.exec(e);return null!==t&&(s=t,!0)}):s=y.exec(i),i=s?s[1]:null}return{elements:l,value:i,type:r,key:n,format:a}}}throw new Error("no related operation found with a type of [".concat(r,"]"))}function p(t,r){var n=t.elements,o=t.type,l=t.key,u=t.format;Array.isArray(n)&&n.length>0&&n.map(function(t){var n=f(t,o);if("class"===n){var i,s,c=null,y=a(t.classList.entries());try{for(y.s();!(s=y.n()).done;){i=e(s.value,2)[1];var p=u.replace("{$}","(.+)"),m=i.match("^".concat(p,"$"));if(m)c=e(m,2)[1]}}catch(h){y.e(h)}finally{y.f()}if(c){var d=u.replace("{$}",c);t.classList.remove(d)}var v=u.replace("{$}",r);t.classList.add(v)}else{var b=r;u&&(b=(b=u.replace("{$}",r)).replace(new RegExp(/\\/g),"")),n[l]=b}})}function m(e,t){e.map(function(e){p(e,t)})}function d(e){var t={elements:[],startupValue:null};return e.map(function(e){var r=y(e);t.elements.push(y(e)),e.useAsStartup&&(t.startupValue=r)}),t.startupValue||(t.startupValue=t.elements[0].value),t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var v={getTargetValue:y,getAllValues:d,setTargetValue:p,setAllValues:m};exports.default=v;
|
11 |
},{}],"LTB1":[function(require,module,exports) {
|
12 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../functions/selector"));function t(e){return e&&e.__esModule?e:{default:e}}var a={props:{label:String,selectors:{type:Array,required:!1,default:function(){return[]}},defaultValue:null,uniqueId:{type:String,required:!1,default:""},elemContainer:{type:String,required:!1,default:""}},data:function(){return{startupValue:null,targetElements:[],elementMainValue:"",mountedDataUpdate:!1}},mounted:function(){if(this.selectors.length>0){var t=e.default.getAllValues(this.selectors);this.targetElements=t.elements,this.startupValue=t.startupValue}},methods:{generateChangeEvent:function(e){var t=this;this.targetElements.map(function(a){a.elements.map(function(a){WPTB_Helper.wptbDocumentEventGenerate("wptb-control:".concat(t.uniqueId),a,{value:e})})})},assignDefaultValue:function(){void 0!==this.startupValue&&""!==this.startupValue&&null!==this.startupValue?(this.mountedDataUpdate=!0,this.elementMainValue=this.startupValue):null!==this.defaultValue&&(this.mountedDataUpdate=!0,this.elementMainValue=this.defaultValue)},setTargetValue:function(t,a){e.default.setTargetValue(t,a)},setAllValues:function(t){e.default.setAllValues(this.targetElements,t)},setTableDirty:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.mountedDataUpdate||(new WPTB_TableStateSaveManager).tableStateSet(),this.mountedDataUpdate=!1},resetMountedState:function(){this.mountedDataUpdate=!0}}},u=a;exports.default=u;
|
13 |
},{"../functions/selector":"wvh1"}],"DTps":[function(require,module,exports) {
|
14 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("../components/IntersectionObserver")),t=n(require("../mixins/ControlBase"));function n(e){return e&&e.__esModule?e:{default:e}}var r={props:{label:String,icons:Object,perPage:{type:Number,default:20}},mixins:[t.default],components:{IntersectionObserver:e.default},data:function(){return{selectedIcon:{url:null,name:null},openDrawer:!1,innerDrawerRef:null,paginationIndex:1,observerHide:!1,debunkedFilterText:"",debunkId:-1,filterText:"",drawerPosition:{left:0}}},mounted:function(){var e=this;document.addEventListener("keyup",function(t){"Escape"===t.code&&e.openDrawer&&e.setDrawerState(!1)}),this.assignDefaultValue();var t=this.elementMainValue;this.selectedIcon.name=""===t?null:t,this.selectedIcon.url=""===t?null:this.icons[t]},watch:{debunkedFilterText:function(e){var t=this;clearTimeout(this.debunkId),this.debunkId=setTimeout(function(){t.filterText=e},500)},selectedIcon:{handler:function(){var e=this,t=this.targetElements[0].elements;t&&Array.isArray(t)&&(this.selectedIcon.url?fetch(this.selectedIcon.url).then(function(e){return e.text()}).then(function(n){e.setTargetValue(e.targetElements[0],e.selectedIcon.name);var r=document.createRange();t.map(function(e){e.innerHTML="",r.setStart(e,0);var t=r.createContextualFragment(n);e.appendChild(t)})}):(this.setTargetValue(this.targetElements[0],""),t.map(function(e){e.innerHTML=""})))},deep:!0}},methods:{setDrawerState:function(e){this.openDrawer=e},fullIconList:function(){var e=this;return Object.keys(this.icons).filter(function(t){return t.includes(e.filterText)}).slice(0,this.paginationIndex*this.perPage).reduce(function(t,n){return t[n]=e.icons[n],t},{})},toggleIconDrawer:function(){this.calculateDrawerPosition(),this.openDrawer=!this.openDrawer,this.innerDrawerRef=this.$refs.drawerRefElement},setIcon:function(e,t){this.selectedIcon.url=t,this.selectedIcon.name=e,this.toggleIconDrawer(),this.setTableDirty()},observerVisible:function(){this.paginationIndex+=1},calculateDrawerPosition:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=this.$refs.iconSelectButton.getBoundingClientRect(),n=t.x+t.width+e,r=t.y;this.drawerPosition.top=this.toPx(r),this.drawerPosition.left=this.toPx(n)},toPx:function(e){return"".concat(e,"px")}}};exports.default=r;
|
15 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[i("div",{staticClass:"wptb-settings-space-between"},[i("p",{staticClass:"wptb-settings-item-title"},[e._v(e._s(e.label))]),e._v(" "),i("div",{staticClass:"wptb-icon-select-wrapper"},[i("div",{staticClass:"wptb-icon-select-display"},[i("div",{ref:"iconSelectButton",staticClass:"wptb-icon-select-preview",on:{click:e.toggleIconDrawer}},[i("img",{attrs:{src:e.selectedIcon.url}})]),e._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:e.openDrawer,expression:"openDrawer"}],staticClass:"wptb-icon-select-drawer wptb-plugin-box-shadow-md",style:e.drawerPosition},[i("div",{staticClass:"wptb-icon-search-wrapper"},[i("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.debunkedFilterText,expression:"debunkedFilterText",modifiers:{trim:!0}}],attrs:{type:"text",placeholder:"Search for icons..."},domProps:{value:e.debunkedFilterText},on:{input:function(t){t.target.composing||(e.debunkedFilterText=t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),i("div",{ref:"drawerRefElement",staticClass:"wptb-icon-previews"},[i("div",{staticClass:"wptb-icon-select-drawer-preview wptb-icon-reset",on:{click:function(t){return e.setIcon("","")}}}),e._v(" "),e._l(e.fullIconList(),function(t,s){return i("div",{key:s,staticClass:"wptb-icon-select-drawer-preview",class:{"wptb-icon-preview-active":e.selectedIcon.name===s}},[i("img",{attrs:{src:t,title:s,draggable:!1},on:{click:function(i){return e.setIcon(s,t)}}})])}),e._v(" "),i("intersection-observer",{attrs:{"relative-element":e.innerDrawerRef,"force-hide":e.observerHide},on:{visible:e.observerVisible}},[i("div",{staticClass:"wptb-icon-select-drawer-end"})])],2)])])])])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
16 |
},{"../components/IntersectionObserver":"WV0h","../mixins/ControlBase":"LTB1"}],"Pn7d":[function(require,module,exports) {
|
17 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("vue")),t=n(require("../functions/WPTB_ControlsManager")),o=n(require("../containers/IconSelectControl"));function n(e){return e&&e.__esModule?e:{default:e}}var r={name:"ControlIconSelect",handler:function(n){var r=t.default.getControlData(n);void 0===r.defaultValue&&(r.defaultValue=null),new e.default({data:r,components:{IconSelectControl:o.default}}).$mount("#".concat(n))}};exports.default=r;
|
18 |
+
},{"vue":"HYXJ","../functions/WPTB_ControlsManager":"WZJa","../containers/IconSelectControl":"DTps"}],"h0P7":[function(require,module,exports) {
|
19 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={inheritAttrs:!1,props:{postFix:{type:String,default:""},value:{type:null,default:0},enableDynamicWidth:{type:Boolean,default:!1},dynamicWidthPadding:{type:Number,default:3},onlyEnter:{type:Boolean,default:!1},min:{type:Number,default:0},max:{type:Number,default:1e3},step:{type:Number,default:1},enableLimit:{type:Boolean,default:!1}},model:{prop:"value",event:"valueChanged"},watch:{value:function(t){this.innerValue=t}},data:function(){return{innerValue:0}},mounted:function(){this.innerValue=this.value},computed:{postFixIt:function(){return"".concat(this.innerValue).concat(this.postFix)},dynamicWidth:function(){return this.enableDynamicWidth?{width:"calc(".concat(this.innerValue.toString().length+this.postFix.length+this.dynamicWidthPadding,"ch) !important")}:{}}},methods:{getValue:function(t){var e=Number.parseFloat(t),i=new RegExp(/^([0-9]+)\.([0-9]+)/,"g").exec(this.step.toString());if(i){var n=i[2].length;e=Number.parseFloat(e.toFixed(n))}return e=isNaN(e)?0:e,this.enableLimit?this.limitValue(e):e},limitValue:function(t){return t<this.min?this.min:t>this.max?this.max:t},handleOnInput:function(t){this.onlyEnter||this.$emit("valueChanged",this.getValue(t.target.value))},handleEnterInput:function(t){this.onlyEnter&&this.$emit("valueChanged",this.getValue(t.target.value))},handleKeyPress:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"up",e=this.getValue(this.innerValue);switch(t){case"up":e+=this.step;break;case"down":e-=this.step;break;default:e+=this.step}e=this.getValue(e),this.$emit("valueChanged",e)}}};exports.default=t;
|
20 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,n=e.$createElement;return(e._self._c||n)("input",{style:e.dynamicWidth,attrs:{type:"text",disabled:e.$attrs.disabled},domProps:{value:e.postFixIt},on:{input:e.handleOnInput,keydown:[function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"up",38,n.key,["Up","ArrowUp"])?null:(n.preventDefault(),e.handleKeyPress("up"))},function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"down",40,n.key,["Down","ArrowDown"])?null:(n.preventDefault(),e.handleKeyPress("down"))},function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:(n.preventDefault(),e.handleEnterInput(n))}]}})},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
21 |
+
},{}],"W4BN":[function(require,module,exports) {
|
22 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=u(require("../mixins/ControlBase")),t=u(require("../components/NumberPostfixInput"));function u(e){return e&&e.__esModule?e:{default:e}}var i={props:{min:{type:Number,default:1,required:!1},max:{type:Number,default:10,required:!1},step:{type:Number,default:1,required:!1},defaultValue:{type:Number,default:1,required:!1},postFix:{type:String,default:""}},mixins:[e.default],components:{NumberPostfixInput:t.default},mounted:function(){this.assignDefaultValue()},watch:{elementMainValue:function(e){var t=this.clampValue(e);this.setAllValues(t),this.generateChangeEvent(t),this.setTableDirty(!0)}},methods:{clampValue:function(e){return e<this.min?this.min:e>this.max?this.max:e}}};exports.default=i;
|
23 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("div",{staticClass:"wptb-settings-item-header"},[e._v(e._s(e.label))]),e._v(" "),a("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[a("div",{staticClass:"wptb-settings-col-xs-8"},[a("input",{directives:[{name:"model",rawName:"v-model",value:e.elementMainValue,expression:"elementMainValue"}],staticClass:"wptb-element-property wptb-size-slider",class:e.uniqueId,attrs:{type:"range","data-element":e.elemContainer,"data-type":"range",min:e.min,max:e.max,step:e.step},domProps:{value:e.elementMainValue},on:{__r:function(t){e.elementMainValue=t.target.value}}})]),e._v(" "),a("div",{staticClass:"wptb-settings-col-xs-4"},[a("number-postfix-input",{staticClass:"wptb-size-number wptb-number-input wptb-element-property",class:e.uniqueId,staticStyle:{"text-align":"center"},attrs:{"post-fix":e.postFix,"only-enter":!0,min:e.min,max:e.max,"data-element":e.elemContainer,step:e.step,"enable-limit":!0,"data-type":"range"},model:{value:e.elementMainValue,callback:function(t){e.elementMainValue=t},expression:"elementMainValue"}})],1)])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
24 |
+
},{"../mixins/ControlBase":"LTB1","../components/NumberPostfixInput":"h0P7"}],"YVYX":[function(require,module,exports) {
|
25 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=o(require("vue")),t=o(require("../containers/RangeControl")),n=o(require("../functions/WPTB_ControlsManager"));function o(e){return e&&e.__esModule?e:{default:e}}var r={name:"ControlRange",handler:function(o){var r=n.default.getControlData(o);new e.default({data:r,components:{RangeControl:t.default}}).$mount("#".concat(o))}};exports.default=r;
|
26 |
},{"vue":"HYXJ","../containers/RangeControl":"W4BN","../functions/WPTB_ControlsManager":"WZJa"}],"Y9Ty":[function(require,module,exports) {
|
27 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../mixins/ControlBase"));function t(e){return e&&e.__esModule?e:{default:e}}var s={props:{options:Object},mixins:[e.default],mounted:function(){this.assignDefaultValue()},watch:{elementMainValue:function(e){this.generateChangeEvent(e),this.setAllValues(e),this.setTableDirty(!0)}}};exports.default=s;
|
38 |
},{}],"cW6v":[function(require,module,exports) {
|
39 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../functions/DeBouncer"));function t(e){return e&&e.__esModule?e:{default:e}}var i={props:{clone:{type:Boolean,default:!1,required:!1},cloneQuery:{type:String,required:!0},tableDirectives:{type:String,default:""},tableStyle:{type:Object,default:function(){}}},inheritAttrs:!1,data:function(){return{cloneInner:!1,clonedTable:null,mainTable:null,tableDirectiveDatasetId:"wptbResponsiveDirectives",tableHaveDirectives:!1}},mounted:function(){this.cloneInner=this.clone},watch:{clone:function(e){this.cloneInner=e},cloneInner:function(e){e&&(this.startClone(),this.cloneInner=!1)},tableDirectives:function(e){e&&this.addDirectivesToTable(e)},"appOptions.identifyCells":{handler:function(e){e&&(this.showCellIdentification(),this.appOptions.identifyCells=!1)}},"directives.responsiveEnabled":{handler:function(e){e&&(this.mainTable.dataset.wptbAdaptiveTable=0)}}},methods:{startClone:function(){if(this.mainTable=document.querySelector(this.cloneQuery),!this.mainTable)throw new Error("no clone target is found with a query value of ".concat(this.cloneQuery));this.appOptions.hasLegacyResponsive="1"===this.mainTable.dataset.wptbAdaptiveTable,this.clonedTable=this.mainTable.cloneNode(!0),this.clonedTable.classList.add("wptb-plugin-box-shadow-xl"),this.$refs.tableClone.appendChild(this.clonedTable);var e=this.mainTable.dataset[this.tableDirectiveDatasetId];this.tableDirectives&&this.addDirectivesToTable(this.tableDirectives),this.tableHaveDirectives=void 0!==e,this.setupCellIdentification(this.clonedTable),this.$emit("tableCloned",e)},addDirectivesToTable:function(e){this.clonedTable&&this.mainTable&&(this.clonedTable.dataset[this.tableDirectiveDatasetId]=e,this.mainTable.dataset[this.tableDirectiveDatasetId]=e,this.$emit("directivesCopied",this.tableHaveDirectives),this.tableHaveDirectives=!1)},setupCellIdentification:function(e){Array.from(e.querySelectorAll("td")).map(function(e,t){"relative"!==getComputedStyle(e).position&&(e.style.position="relative");var i=document.createRange();i.setStart(e,0);var a="background-color: hsla(211, 25%, ".concat(t%2==0?70:90,"%, 80%)"),n='<div class="wptb-responsive-cell-identifier" style="'.concat(a,'">').concat(t+1,"</div>"),l=i.createContextualFragment(n);e.appendChild(l.childNodes[0])})},showCellIdentification:function(){var t=this;this.clonedTable.classList.add("wptb-responsive-show-cell-identifier"),(0,e.default)("cellIdentification",function(){t.clonedTable.classList.remove("wptb-responsive-show-cell-identifier")},2e3)}}};exports.default=i;
|
40 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"wptb-responsive-clone-wrapper"},[t("div",{staticClass:"wptb-responsive-clone-inner-wrapper"},[t("div",{ref:"tableClone",style:this.tableStyle})])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
41 |
+
},{"../functions/DeBouncer":"qsi5"}],"xi3E":[function(require,module,exports) {
|
|
|
|
|
|
|
42 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=e(require("./NumberPostfixInput"));function e(t){return t&&t.__esModule?t:{default:t}}var a={props:{value:{type:Number,default:0},rawValue:{type:Number,default:0},active:{type:Boolean,default:!1},stopId:String,enableBreakpointCustomization:{type:Boolean,default:!1}},components:{NumberPostfixInput:t.default},data:function(){return{wrapperStyle:{left:0,top:0},innerRawValue:this.rawValue}},watch:{rawValue:function(t){this.innerRawValue=t},value:function(){this.calculateStyle()},innerRawValue:function(t){this.$emit("breakpointChange",t,this.stopId)}},mounted:function(){var t=this;this.$nextTick(function(){t.calculateStyle()})},methods:{clickEvent:function(){this.$emit("click",this.rawValue)},calculateStyle:function(){var t=this.$refs.wrapper,e=this.$refs.knob;if(t){var a=t.getBoundingClientRect().width;this.wrapperStyle.left="calc(".concat(this.value,"% - ").concat(a/2,"px)")}if(e){var n=e.getBoundingClientRect().height;this.wrapperStyle.top="-".concat(n/2,"px")}}}};exports.default=a;
|
43 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"wrapper",staticClass:"wptb-slider-stop",class:{"wptb-slider-stop-active":e.active},style:e.wrapperStyle,on:{"!click":function(t){return t.preventDefault(),e.clickEvent(t)}}},[i("div",{ref:"knob",staticClass:"wptb-slider-stop-knob"}),e._v(" "),i("div",{staticClass:"wptb-slider-stop-label"},[e._t("default")],2),e._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:e.enableBreakpointCustomization,expression:"enableBreakpointCustomization"}]},[i("number-postfix-input",{staticClass:"wptb-size-input",staticStyle:{"font-size":"90%"},attrs:{"enable-dynamic-width":!0,"only-enter":!0,"post-fix":"px"},model:{value:e.innerRawValue,callback:function(t){e.innerRawValue=t},expression:"innerRawValue"}})],1)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
44 |
},{"./NumberPostfixInput":"h0P7"}],"ooD9":[function(require,module,exports) {
|
48 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{positionPercentage:{type:Number,default:0}},data:function(){return{style:{left:0}}},watch:{positionPercentage:{handler:function(){this.calculateStyle()},deep:!0}},mounted:function(){this.calculateStyle()},methods:{calculateStyle:function(){var e=this.$refs.arrowWrapper.getBoundingClientRect().width;this.style.left="calc(".concat(this.positionPercentage,"% - ").concat(e/2,"px)")},handleDrag:function(e){var t=e.screenX,a=e.screenY;0===t&&0===a||this.$emit("arrowDrag",e)}}};exports.default=e;
|
49 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{ref:"arrowWrapper",staticClass:"wptb-screen-size-slider-arrow",style:e.style,attrs:{draggable:"true"},on:{drag:function(t){return t.preventDefault(),e.handleDrag(t)},dragover:function(e){e.preventDefault()},dragend:function(t){return t.preventDefault(),e.$emit("arrowDragEnd")},drop:function(e){e.preventDefault()},dragexit:function(e){e.preventDefault()},dragleave:function(e){e.preventDefault()}}},[r("svg",{attrs:{width:"17",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"}},[r("path",{attrs:{d:"M8.5 16L0 0h17L8.5 16z",fill:"var(--wptb-plugin-logo-color)"}})])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
50 |
},{}],"V4gv":[function(require,module,exports) {
|
51 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=n(require("./SliderStop")),e=n(require("./SliderFill")),i=n(require("./SliderArrow"));function n(t){return t&&t.__esModule?t:{default:t}}var r={props:{stops:Object,endPadding:{type:Number,default:0},modelVal:{type:Number,default:0},enableBreakpointCustomization:{type:Boolean,default:!1}},components:{SliderStop:t.default,SliderFill:e.default,SliderArrow:i.default},data:function(){return{min:0,max:100,currentVal:0,isDragging:!1,minSizeBetweenBreakpoints:100,repaintId:0}},beforeMount:function(){this.calculateMinMax()},watch:{currentVal:function(){this.$emit("slide",this.currentVal)},modelVal:function(t){this.currentVal=Math.floor(t)},"directives.relativeWidth":{handler:function(){this.repaintId+=1},deep:!0}},methods:{handleBreakpointChange:function(t,e){var i=this.directives.breakpoints;if(!i[e])throw new Error("no breakpoint found with the given ID: [".concat(e,"]"));var n=Object.keys(i).sort(function(t,e){return i[t].width-i[e].width}),r=n.indexOf(e),a=n[r-1],s=n[r+1];a&&i[a].width>=t&&(t=i[a].width+this.minSizeBetweenBreakpoints),s&&i[s].width<=t&&(t=i[s].width-this.minSizeBetweenBreakpoints),i[e].width=t,this.calculateMinMax(),this.repaintId+=1},calculateMinMax:function(){var t=Object.values(this.stops).sort(function(t,e){return-1*(e.width-t.width)});this.min=t[0].width-this.endPadding,this.max=t[t.length-1].width+this.endPadding,this.currentVal=t[t.length-1].width},translateIntoPercent:function(t){var e=this.max-this.min;return 100*(t-this.min)/e},slide:function(t){this.currentVal=t},handleArrowDrag:function(t){this.isDragging=!0;var e=this.$refs.sliderWrapper.getBoundingClientRect(),i=e.left,n=e.width,r=(t.clientX-i)*(this.max-this.min)/n;this.currentVal=this.limitToRange(this.min+r)},limitToRange:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t;return t<this.min&&(i=this.min),t>this.max&&(i=this.max),e&&(i=Math.floor(i)),i},isStopActive:function(t){var e=this;return this.currentVal>=t&&Object.values(this.stops).filter(function(t){return t<=e.currentVal}).every(function(e){return e<=t})}}};exports.default=r;
|
52 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{key:e.repaintId,ref:"sliderWrapper",staticClass:"wptb-screen-size-slider-wrapper",class:{"wptb-drag-active":e.isDragging}},[r("div",{staticClass:"wptb-screen-size-slider-empty"},[r("slider-arrow",{attrs:{"position-percentage":e.translateIntoPercent(e.limitToRange(e.currentVal))},on:{arrowDrag:e.handleArrowDrag,arrowDragEnd:function(t){e.isDragging=!1}}}),e._v(" "),r("slider-fill",{attrs:{amount:e.translateIntoPercent(e.limitToRange(e.currentVal))}}),e._v(" "),e._l(e.stops,function(t,a){var n=t.name,i=t.width;return r("slider-stop",{key:a,attrs:{active:e.isStopActive(i),value:e.translateIntoPercent(i),"raw-value":i,"stop-id":a,enableBreakpointCustomization:e.enableBreakpointCustomization},on:{click:e.slide,breakpointChange:e.handleBreakpointChange}},[e._v(e._s("window"===e.directives.relativeWidth?n:i+"px")+" ")])})],2)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
53 |
},{"./SliderStop":"xi3E","./SliderFill":"ooD9","./SliderArrow":"q8F8"}],"phKF":[function(require,module,exports) {
|
54 |
|
55 |
var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};
|
56 |
},{}],"Q6f0":[function(require,module,exports) {
|
57 |
var global = arguments[3];
|
58 |
var process = require("process");
|
59 |
+
var e=arguments[3],t=require("process");function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){o(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return(a="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})(e)}!function(e,t,n){"object"===("undefined"==typeof exports?"undefined":a(exports))&&"undefined"!=typeof module?module.exports=n():t[e]=n()}("WPTB_ResponsiveFrontend",self||e,function(){function e(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]}function t(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.element=e,this.referenceObject=n,this.mergedRenderStatus=!0,this.mergedCells={row:[],column:[]},this.getMergedRenderStatus=function(){return t.mergedRenderStatus},this.setMergedRenderStatus=function(e){t.mergedRenderStatus=e},this.addToMergedCells=function(e,n){t.mergedCells[e].push(n)},this.isReference=function(){return null!==t.referenceObject},this.isReference()&&(this.element=e.cloneNode(!0)),this.modifications={},this.spans={row:1,col:1},this.remainingSpans={row:0,col:0},this.cacheSpanValues=function(){Object.keys(t.spans).map(function(e){if(Object.prototype.hasOwnProperty.call(t.spans,e)){var n=t.spans[e];t.spans[e]=t.element.getAttribute("".concat(e,"Span"))||n}})},this.cacheSpanValues(),this.getSpan=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?t.getElement().getAttribute("".concat(e,"Span")):t.spans[e];if(n)return n;throw new Error("no span value found with the given type of [".concat(e,"]"))},this.getRemainingSpans=function(e){return t.remainingSpans[e]},this.setRemainingSpans=function(e,n){t.remainingSpans[e]=n},this.getElement=function(){return t.element},this.createCellElement=function(){return document.createElement("td")},e||(this.element=this.createCellElement()),this.setAttribute=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:",",i=t.getElement()[e];"function"!=typeof i&&"object"!==a(i)||(i=t.getElement().getAttribute(e)),t.modifications[e]&&(i=t.modifications[e].default);var s=i;r?s+="".concat(s).concat(o).concat(n):s=n,t.modifications[e]={value:s,default:i},t.getElement()[e]=s},this.setSpan=function(e,n){if(!t.isReference()){var r=t.getSpan(e)-n<0?t.getSpan(e):n;t.setAttribute("".concat(e,"Span"),r),t.setRemainingSpans(e,t.getSpan(e)-r);for(var o=0;o<r-1;o+=1)t.mergedCells[e]&&t.mergedCells[e][o]&&t.mergedCells[e][o].setMergedRenderStatus(!1);return!0}if(!t.getMergedRenderStatus())return!1;var a=t.referenceObject.getRemainingSpans(e);if(0===a)return!1;var i=a-n<0?a:n,s=a-i;if(t.referenceObject.setRemainingSpans(e,s),t.setAttribute("".concat(e,"Span"),i),0!==s)for(var l=t.referenceObject.mergedCells[e].length-a+1,d=l+i-1,c=l;c<d;c+=1)t.mergedCells[e][c].setMergedRenderStatus(!1);return!0},this.resetAttribute=function(e){t.modifications[e]&&(t.getElement()[e]=t.modifications[e].default,t.modifications[e]=void 0)},this.resetAllAttributes=function(){Object.keys(t.modifications).map(function(e){Object.prototype.hasOwnProperty.call(t.modifications,e)&&t.resetAttribute(e)})},{getElement:this.getElement,el:this.element,setAttribute:this.setAttribute,resetAllAttributes:this.resetAllAttributes,getSpan:this.getSpan,setSpan:this.setSpan,getRemainingSpans:this.getRemainingSpans,setRemainingSpans:this.setRemainingSpans,isReference:this.isReference,addToMergedCells:this.addToMergedCells,mergedCells:this.mergedCells,setMergedRenderStatus:this.setMergedRenderStatus,getMergedRenderStatus:this.getMergedRenderStatus}}function n(n){var r=this;return this.tableElement=n,this.parsedTable=[],this.rowCache=[],this.originals={rows:[]},this.rowColors={header:null,even:null,odd:null},this.addToParsed=function(e,t,n){r.parsedTable[e]||(r.parsedTable[e]=[]),r.parsedTable[e][t]=n},this.parseTable=function(){var e=Array.from(r.tableElement.querySelectorAll("tr"));e.map(function(e,n){r.originals.rows.push(e),Array.from(e.querySelectorAll("td")).map(function(e,o){var a=new t(e);r.addToParsed(n,o,a);var i=a.getSpan(t.spanTypes.row),s=a.getSpan(t.spanTypes.column);if(i>1)for(var l=1;l<i;l+=1){var d=new t(e,a);a.addToMergedCells("row",d),r.addToParsed(n+l,o,d)}if(s>1)for(var c=1;c<s;c+=1){var u=new t(e,a);a.addToMergedCells("column",u),r.addToParsed(n,o+c,u)}})}),r.parseRowColors(e)},this.parseRowColors=function(t){(!t||t.length<=0)&&e("no rows are found to parse their colors","error");var n=r.tableElement.dataset.wptbHeaderBackgroundColor,o=r.tableElement.dataset.wptbEvenRowBackgroundColor,a=r.tableElement.dataset.wptbOddRowBackgroundColor;r.rowColors.header=void 0!==n?n:""===t[0].style.backgroundColor?null:t[0].style.backgroundColor;for(var i=t.length/3>=1?0:1===t.length?2:(t.length-1)%2,s=0;s<i;s+=1){var l=document.createElement("tr");r.tableElement.querySelector("tbody").appendChild(l),t.push(l)}r.rowColors.even=o||getComputedStyle(t[1]).backgroundColor,r.rowColors.odd=o?a:getComputedStyle(t[2]).backgroundColor;for(var d=0;d<i;d+=1)t[t.length-(d+1)].remove()},this.addRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;Array.isArray(e)||(e=[e]);var o,a=r.tableElement.querySelector("tbody");if(t)o=r.originals.rows[n];else{var i=document.createRange();i.setStart(a,0),o=i.createContextualFragment('<tr class="'.concat(e.join(" "),'"></tr>')).childNodes[0]}return a.appendChild(o),r.rowCache.push(o),{el:o,id:r.rowCache.length-1}},this.clearTable=function(){r.rowCache=[],r.tableElement.querySelector("tbody").innerHTML=""},this.getRow=function(t){return r.rowCache[t]?r.rowCache[t]:(e("no row with id [".concat(t,"] found in the cache."),"warn"),null)},this.maxRows=function(){return r.parsedTable.length},this.maxColumns=function(){return r.parsedTable.reduce(function(e,t){return t.length>e&&(e=t.length),e},0)},this.getCell=function(t,n){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{if(r.parsedTable[t][n])return o?r.parsedTable[t][n]:r.parsedTable[t][n].el}catch(a){return e("no cell found at the given address of [".concat(t,"-").concat(n,"]"),"warn"),null}return e("no cell found at the given address of [".concat(t,"-").concat(n,"]"),"warn"),null},this.getCellsAtRow=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],o=0;o<r.maxColumns();o+=1){var a=r.getCell(e,o,t);a&&n.push(a)}return n},this.appendToRow=function(e,t,n){var o=r.getRow(n),a=r.getCell(e,t,!0);return a&&o&&o.appendChild(a.getElement()),a},this.appendElementToRow=function(e,t){var n=r.getRow(t);e&&n&&n.appendChild(e)},this.appendObjectToRow=function(e,t){var n=r.getRow(t);e&&n&&n.appendChild(e.getElement())},this.parseTable(),{maxRows:this.maxRows,maxColumns:this.maxColumns,addRow:this.addRow,clearTable:this.clearTable,getCell:this.getCell,appendToRow:this.appendToRow,appendElementToRow:this.appendElementToRow,appendObjectToRow:this.appendObjectToRow,getCellsAtRow:this.getCellsAtRow,el:this.tableElement,rowColors:this.rowColors}}t.spanTypes={row:"row",column:"col"};var o={query:".wptb-preview-table",defaultClasses:["wptb-plugin-responsive-base"],bindToResize:!1};return function(){var e=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.options=r({},o,{},a),this.elements=Array.from(document.querySelectorAll(this.options.query)),this.elementObjects=this.elements.map(function(e){return{el:e,tableObject:new n(e)}}),this.bindRebuildToResize=function(){window.addEventListener("resize",function(){e.rebuildTables()})},this.getDirective=function(e){var t=e.dataset.wptbResponsiveDirectives;return t?JSON.parse(atob(t)):null},this.addDefaultClasses=function(t){t.classList.add(e.options.defaultClasses)},this.removeDefaultClasses=function(t){t.classList.remove(e.options.defaultClasses)},this.autoBuild=function(t,n,r,o){var a=r.cellStackDirection[n],i=r.topRowAsHeader[n],s=r.cellsPerRow[n],l=!!r.staticTopRow&&r.staticTopRow[n];o.clearTable(),"desktop"===n?(e.buildDefault(o),e.removeDefaultClasses(t)):(e.autoDirectionBuild(o,a,i,l,s),e.addDefaultClasses(t))},this.autoDirectionBuild=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,i=t.maxRows(),s=t.maxColumns(),l="row"===n;if(r)e.headerBuild(t,n,a);else if(l)!function(){var e=[],n=0;o&&t.getCellsAtRow(0,!0).filter(function(e){return!e.isReference()}).map(function(e){n+=1;var r=t.addRow("wptb-row");r.el.style.backgroundColor=t.rowColors.header,t.appendObjectToRow(e,r.id),e.setAttribute("colSpan",a)});for(var r=n;r<i;r+=1)t.getCellsAtRow(r,!0).forEach(function(t){return e.push(t)});for(var s=e.length,l=0,d=0;l<s;l+=a,d+=1){var c=t.addRow("wptb-row");c.el.style.backgroundColor=t.rowColors[d%2==0?"odd":"even"];for(var u=0;u<a;u+=1){var p=e[l+u];p&&(t.appendElementToRow(p.getElement(),c.id),p.resetAllAttributes(),p.setAttribute("style","width: 100% !important",!0,";"),p.setAttribute("colSpan",1),p.setAttribute("rowSpan",1))}}}();else{var d=[],c=0;o&&t.getCellsAtRow(0,!0).filter(function(e){return!e.isReference()}).map(function(e){c+=1;var n=t.addRow("wptb-row");n.el.style.backgroundColor=t.rowColors.header,t.appendObjectToRow(e,n.id),e.setAttribute("colSpan",a)});for(var u=0;u<s;u+=1)for(var p=c;p<i;p+=1){var f=t.getCell(p,u,!0);f&&d.push(f)}for(var h=d.length,g=0,b=0;g<h;g+=a,b+=1){var w=t.addRow("wptb-row");w.el.style.backgroundColor=t.rowColors[b%2==0?"odd":"even"];for(var m=0;m<a;m+=1){var v=d[g+m];v&&(t.appendElementToRow(v.getElement(),w.id),v.resetAllAttributes(),v.setAttribute("style","width: 100% !important",!0,";"),v.setAttribute("colSpan",1),v.setAttribute("rowSpan",1))}}}},this.headerBuild=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=e.getCellsAtRow(0,!0).map(function(t){return t.setAttribute("style","background-color: ".concat(e.rowColors.header),!0,";"),t}),a="column"===n,i=e.maxRows(),s=e.maxColumns();if(a)for(var l=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=e.addRow("wptb-row");t&&(n.el.style.borderTop="3px solid gray"),o.map(function(t){e.appendElementToRow(t.el.cloneNode(!0),n.id)})},d=Math.ceil((i-1)/r),c=1,u=0;u<d;u+=1){l(u>0);for(var p=0;p<r&&!(c>=i);p+=1){var f=e.addRow("wptb-row");f.el.style.backgroundColor=e.rowColors[p%2==0?"even":"odd"];for(var h=0;h<s;h+=1){var g=e.getCell(c,h,!0);if(g){g.resetAllAttributes();var b=!0,w=g.getSpan(t.spanTypes.row);if(g.getSpan(t.spanTypes.column),w>1){var m=r-p,v=Math.min(w,m);b=g.setSpan(t.spanTypes.row,v),g.setMergedRenderStatus(!0)}b&&e.appendObjectToRow(g,f.id)}}c+=1}}else for(var R=Math.ceil((i-1)/r),C=1,y=0;y<R;y+=1){for(var S=0;S<s;S+=1){var T=e.addRow("wptb-row");T.el.style.backgroundColor="none",y>0&&0===S&&(T.el.style.borderTop="3px solid gray");var A=o[S].el.cloneNode(!0);A.style.backgroundColor="".concat(e.rowColors.header," !important"),e.appendElementToRow(A,T.id);for(var O=0;O<r&&!(C+O>=i);O+=1){var E=e.getCell(C+O,S,!0);if(E){E.resetAllAttributes();var j=!0,k=E.getSpan(t.spanTypes.row);if(E.getSpan(t.spanTypes.column),k>1){var M=r-O,x=Math.min(k,M);j=E.setSpan(t.spanTypes.row,x);var D=E.el.getAttribute("rowSpan"),P=E.el.getAttribute("colSpan");E.setAttribute("rowSpan",P),E.setAttribute("colSpan",D),E.setMergedRenderStatus(!0)}if(j){var B=(C+O+y)%2==0?"even":"odd";1===r&&(B=C%2==0?"even":"odd"),E.setAttribute("style","background-color: ".concat(e.rowColors[B]),!0,";"),e.appendObjectToRow(E,T.id)}}}}C+=r}},this.buildDefault=function(e){for(var t=e.maxRows(),n=e.maxColumns(),r=0;r<t;r+=1)for(var o=e.addRow("",!0,r).id,a=0;a<n;a+=1){var i=e.getCell(r,a,!0);i&&!i.isReference()&&(i.resetAllAttributes(),e.appendElementToRow(i.getElement(),o))}},this.calculateRangeId=function(e,t){var n=Object.keys(t).sort(function(e,n){return t[e].width-t[n].width}),r=n[0];return n.map(function(n){e>=t[n].width&&(r=n)}),r},this.rebuildTable=function(t,n,r){var o=e.getDirective(t);if(o){if(!o.responsiveEnabled)return;var a=o.responsiveMode,i=e["".concat(a,"Build")];n||(n=t.getBoundingClientRect().width);var s=e.calculateRangeId(n,o.breakpoints);if(!i)throw new Error("No build mode named as [".concat(a,"] found."));var l=o.modeOptions[a];i.call(e,t,s,l,r)}},this.rebuildTables=function(t){e.elementObjects.map(function(n){var r=t;if(!t){r=window.innerWidth;var o=e.getDirective(n.el);if(o&&o.relativeWidth)switch(o.relativeWidth){case"window":r=window.innerWidth;break;case"container":r=n.el.parentNode.parentNode.parentNode.clientWidth;break;default:r=window.innerWidth}}e.rebuildTable(n.el,r,n.tableObject)})},this.options.bindToResize&&this.bindRebuildToResize(),{rebuildTables:this.rebuildTables}}});
|
60 |
},{"process":"phKF"}],"ATQh":[function(require,module,exports) {
|
61 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={props:{click:{type:Function,default:function(){console.log("Material button clicked")}},size:{type:String,default:"fit-content"}},computed:{buttonClass:function(){return["wptb-plugin-button-material-".concat(this.size)]}}};exports.default=t;
|
62 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"wptb-plugin-button-material",class:t.buttonClass,on:{click:function(e){return e.preventDefault(),t.click(e)}}},[t._t("default")],2)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
85 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"wptb-element-option wptb-settings-items wptb-plugin-width-full"},[n("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs"},[n("label",{staticClass:"wptb-control-row wptb-flex wptb-flex-row wptb-flex-align-center wptb-flex-justify-space-between"},[n("span",{staticStyle:{"font-size":"16px"}},[e._v(" "+e._s(e.label)+" ")]),e._v(" "),n("select",{directives:[{name:"model",rawName:"v-model",value:e.innerValue,expression:"innerValue"}],attrs:{disabled:e.disabled},on:{change:function(t){var n=Array.prototype.filter.call(t.target.options,function(e){return e.selected}).map(function(e){return"_value"in e?e._value:e.value});e.innerValue=t.target.multiple?n:n[0]}}},e._l(e.options,function(t,l){return n("option",{key:l,domProps:{value:l}},[e._v(e._s(e._f("cap")(t)))])}),0)])])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
86 |
},{"../mixins/PanelControlBase":"vpWQ"}],"DmVJ":[function(require,module,exports) {
|
87 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("vue-fragment"),r=t(require("./PanelToggleControl")),o=t(require("./PanelDropdownControl"));function t(e){return e&&e.__esModule?e:{default:e}}var n={components:{PanelToggleControl:r.default,PanelDropdownControl:o.default,Fragment:e.Fragment}};exports.default=n;
|
88 |
+
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,i=e.$createElement,s=e._self._c||i;return s("fragment",[s("panel-toggle-control",{attrs:{label:e._f("cap")(e.strings.enableResponsive)},model:{value:e.directives.responsiveEnabled,callback:function(i){e.$set(e.directives,"responsiveEnabled",i)},expression:"directives.responsiveEnabled"}}),e._v(" "),s("panel-dropdown-control",{attrs:{label:e._f("cap")(e.strings.relative),options:{window:e.strings.window,container:e.strings.container},disabled:!e.directives.responsiveEnabled},model:{value:e.directives.relativeWidth,callback:function(i){e.$set(e.directives,"relativeWidth",i)},expression:"directives.relativeWidth"}}),e._v(" "),s("panel-dropdown-control",{attrs:{label:e._f("cap")(e.strings.mode),options:{auto:"auto"},disabled:!e.directives.responsiveEnabled},model:{value:e.directives.responsiveMode,callback:function(i){e.$set(e.directives,"responsiveMode",i)},expression:"directives.responsiveMode"}})],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
89 |
},{"vue-fragment":"CDb8","./PanelToggleControl":"osOD","./PanelDropdownControl":"fI53"}],"UchZ":[function(require,module,exports) {
|
90 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{header:{type:String,default:"Tab Header"},tabs:{type:Object,default:function(){return{default:"Default"}}},currentTab:{type:String,default:"default"}},methods:{isActiveTab:function(e){return this.currentTab===e},handleTabClick:function(e){this.$emit("tabClicked",e)}}};exports.default=e;
|
91 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"wptb-section-group-tabbed wptb-plugin-box-shadow-md wptb-plugin-width-full"},[s("div",{staticClass:"wptb-panel-toggle wptb-section-group-tabbed-header"},[s("div",{staticClass:"header"},[t._v(t._s(t.header))])]),t._v(" "),s("div",{staticClass:"wptb-section-group-tabbed-tabs-buttons"},t._l(t.tabs,function(e,i){return s("div",{key:i,staticClass:"wptb-settings-section-item static-active",class:{active:t.isActiveTab(i),disabled:!t.isActiveTab(i)},on:{"!click":function(e){return e.preventDefault(),t.handleTabClick(i)}}},[t._v(" "+t._s(e)+" ")])}),0),t._v(" "),s("div",{staticClass:"wptb-section-group-tab-content"},[t._t("default")],2)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
99 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("./PanelSectionGroupTabbed")),t=r(require("./AutoModePanelControls"));function r(e){return e&&e.__esModule?e:{default:e}}var o={components:{PanelSectionGroupTabbed:e.default,AutoModePanelControls:t.default},computed:{breakpointsObject:function(){var e=this;return Object.keys(this.directives.breakpoints).sort(function(t,r){return e.directives.breakpoints[t].width-e.directives.breakpoints[r].width}).reduce(function(t,r){return Object.prototype.hasOwnProperty.call(e.directives.breakpoints,r)&&(t[r]=e.directives.breakpoints[r].name),t},{})},currentPanelControls:function(){return"".concat(this.directives.responsiveMode[0].toUpperCase()+this.directives.responsiveMode.slice(1),"ModePanelControls")}},methods:{handleTabChange:function(e){this.appOptions.currentBreakpoint=e,this.appOptions.currentSize=this.directives.breakpoints[e].width}}};exports.default=o;
|
100 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this.$createElement,e=this._self._c||t;return e("panel-section-group-tabbed",{attrs:{"current-tab":this.appOptions.currentBreakpoint,tabs:this.breakpointsObject,header:this.strings[this.directives.responsiveMode]},on:{tabClicked:this.handleTabChange}},[e(this.currentPanelControls,{tag:"component"})],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
101 |
},{"./PanelSectionGroupTabbed":"UchZ","./AutoModePanelControls":"rfRR"}],"Ub7O":[function(require,module,exports) {
|
102 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=l(require("vue")),t=l(require("../containers/ResponsiveApp")),n=l(require("../components/ResponsiveControlsRow")),o=l(require("../functions/WPTB_ControlsManager")),r=l(require("../plugins/filters")),s=l(require("../plugins/strings")),a=l(require("../components/ResponsivePanelGeneralControls")),i=l(require("../components/ResponsivePanelModeControls"));function l(e){return e&&e.__esModule?e:{default:e}}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d={name:"ResponsiveTable",handler:function(l){var p=o.default.getControlData("responsiveMenuData"),c={responsiveEnabled:!1,responsiveMode:"auto",preserveRowColor:!1,relativeWidth:"window",modeOptions:{auto:{topRowAsHeader:{desktop:!1,tablet:!1,mobile:!1},staticTopRow:{desktop:!1,tablet:!1,mobile:!1},cellStackDirection:{desktop:"row",tablet:"row",mobile:"row"},cellsPerRow:{desktop:1,tablet:1,mobile:1}}},breakpoints:p.screenSizes};e.default.use({install:function(e,t){var n=t.components;e.mixin({components:n})}},{components:{ResponsiveControlsRow:n.default}}),e.default.use({install:function(e,t){e.mixin({data:function(){return t.data}})}},{data:{appOptions:{identifyCells:!1,hasLegacyResponsive:!1,currentBreakpoint:"desktop",currentSize:0},directives:c}}),e.default.use(r.default),e.default.use(s.default,p),new e.default({components:{ResponsiveApp:t.default},data:u({mainTableQuery:".wptb-preview-table"},p),template:'<responsive-app :clone-query="mainTableQuery" :screen-sizes="screenSizes" :compare-sizes="compareSizes"></responsive-app>'}).$mount("#".concat(l)),new e.default({components:{ResponsivePanelGeneralControls:a.default},template:"<responsive-panel-general-controls></responsive-panel-general-controls>"}).$mount("#responsiveBuilderLeftPanelGeneralControls"),new e.default({components:{ResponsivePanelModeControls:i.default},data:u({},p),template:"<responsive-panel-mode-controls></responsive-panel-mode-controls>"}).$mount("#responsiveBuilderLeftPanelModeOptions")}};exports.default=d;
|
103 |
},{"vue":"HYXJ","../containers/ResponsiveApp":"waBm","../components/ResponsiveControlsRow":"TuCQ","../functions/WPTB_ControlsManager":"WZJa","../plugins/filters":"GZC0","../plugins/strings":"yEip","../components/ResponsivePanelGeneralControls":"DmVJ","../components/ResponsivePanelModeControls":"BxO6"}],"n7p4":[function(require,module,exports) {
|
104 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{label:{type:String,default:"top"},value:{type:Number,default:0},disabled:{type:Boolean,default:!1}},model:{prop:"value",event:"valueChanged"},mounted:function(){this.innerValue=this.value},data:function(){return{innerValue:0}},watch:{value:function(e){this.innerValue=e},innerValue:function(e){this.$emit("valueChanged",Number.parseInt(e,10))}},methods:{inputChange:function(e){this.$emit("changedFromFront",this.$vnode.key,e.target.value),this.innerValue=e.target.value}}};exports.default=e;
|
105 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"wptb-side-control-input-wrapper wptb-side-control-number-input"},[n("div",{staticClass:"wptb-side-control-header"},[t._v(" "+t._s(t._f("cap")(t.label))+" ")]),t._v(" "),n("div",[n("input",{staticClass:"wptb-side-control-main-input",attrs:{type:"number",disabled:t.disabled},domProps:{value:t.innerValue},on:{input:t.inputChange}})])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
107 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{value:{type:String,default:"px"}},model:{prop:"value",event:"valueChanged"},data:function(){return{options:["px","%"],innerValue:""}},mounted:function(){this.innerValue=this.value},watch:{value:function(e){this.innerValue=e},innerValue:function(e){this.$emit("valueChanged",e)}},methods:{isSelected:function(e){return this.innerValue===e}}};exports.default=e;
|
108 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"wptb-side-control-input-wrapper wptb-side-control-dropdown-wrapper"},[n("select",{directives:[{name:"model",rawName:"v-model",value:e.innerValue,expression:"innerValue"}],staticClass:"wptb-side-control-main-input wptb-side-control-dropdown",on:{change:function(t){var n=Array.prototype.filter.call(t.target.options,function(e){return e.selected}).map(function(e){return"_value"in e?e._value:e.value});e.innerValue=t.target.multiple?n:n[0]}}},e._l(e.options,function(t){return n("option",{key:t,domProps:{value:t,selected:e.isSelected(t)}},[e._v(e._s(t))])}),0)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
109 |
},{}],"ouPJ":[function(require,module,exports) {
|
110 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("../mixins/ControlBase")),t=n(require("../components/SideInput")),i=n(require("../components/SideDropdown"));function n(e){return e&&e.__esModule?e:{default:e}}function r(e){return l(e)||s(e)||d(e)||a()}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function l(e){if(Array.isArray(e))return f(e)}function u(e,t){return h(e)||c(e,t)||d(e,t)||o()}function o(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){if(e){if("string"==typeof e)return f(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function c(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var i=[],n=!0,r=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(n=(s=l.next()).done)&&(i.push(s.value),!t||i.length!==t);n=!0);}catch(u){r=!0,a=u}finally{try{n||null==l.return||l.return()}finally{if(r)throw a}}return i}}function h(e){if(Array.isArray(e))return e}var p={props:{linkIcon:{type:String,default:null},unlinkIcon:{type:String,default:null},strings:{type:Object,required:!0},defaultValue:{type:String,default:"0 0 0 0"}},mixins:[e.default],components:{SideInput:t.default,SideDropdown:i.default},data:function(){return{linkValues:!1,sideValues:{top:0,right:0,bottom:0,left:0},lastEdited:"top",type:"px",suppressDirty:!0}},mounted:function(){this.assignDefaultValue(),this.parseElementValue()},updated:function(){this.suppressDirty=!1},watch:{sideValues:{handler:function(){this.calculateElementValue()},deep:!0},elementMainValue:{handler:function(e){this.setAllValues(e),this.generateChangeEvent(e),this.suppressDirty&&this.resetMountedState(),this.setTableDirty(!0)},immediate:!0},linkValues:function(){this.calculateElementValue()},type:function(){this.calculateElementValue()}},methods:{inputChanged:function(e){this.lastEdited=e},calculateElementValue:function(){var e=this;this.assignLinkedValues(),this.elementMainValue=Object.keys(this.sideValues).map(function(t){if(Object.prototype.hasOwnProperty.call(e.sideValues,t))return e.sideValues[t]+e.type}).join(" ")},assignLinkedValues:function(){var e=this;this.linkValues&&Object.keys(this.sideValues).filter(function(t){return t!==e.lastEdited}).map(function(t){Object.prototype.hasOwnProperty.call(e.sideValues,t)&&(e.sideValues[t]=e.sideValues[e.lastEdited])})},parseElementValue:function(){var e="px";this.elementMainValue.split(" ").map(function(t){var i=t.match(/([a-z%?]+)/);if(i&&i[1]){var n=u(i,2);e=n[1]}}),this.type=e;var t=r(this.elementMainValue.matchAll(/[\d]+/g)).flatMap(function(e){return Number.parseInt(e[0],10)});if(t)if(1===t.length){var i=u(t,1);this.sideValues.top=i[0];var n=u(t,1);this.sideValues.bottom=n[0];var a=u(t,1);this.sideValues.left=a[0];var s=u(t,1);this.sideValues.right=s[0],this.linkValues=!0}else if(2===t.length){var l=u(t,2);this.sideValues.bottom=l[0],this.sideValues.left=l[1];var o=u(t,2);this.sideValues.top=o[0],this.sideValues.right=o[1]}else if(3===t.length){var d=u(t,3);this.sideValues.top=d[0],this.sideValues.right=d[1],this.sideValues.bottom=d[2],this.sideValues.left=0}else{var f=u(t,4);this.sideValues.top=f[0],this.sideValues.right=f[1],this.sideValues.bottom=f[2],this.sideValues.left=f[3]}}}};exports.default=p;
|
111 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,s=e.$createElement,t=e._self._c||s;return t("div",[t("div",{staticClass:"wptb-settings-item-header-include-right"},[t("div",{staticClass:"wptb-settings-space-between"},[t("div",[e._v(e._s(e._f("cap")(e.label)))]),e._v(" "),t("div",{on:{click:function(s){s.preventDefault(),e.linkValues=!e.linkValues}}},[e.linkValues?t("div",{staticClass:"wptb-sides-link-icon-wrapper"},[t("img",{attrs:{src:e.unlinkIcon,title:e.strings.unlink}})]):t("div",{staticClass:"wptb-sides-link-icon-wrapper"},[t("img",{attrs:{src:e.linkIcon,title:e.strings.link}})])])])]),e._v(" "),t("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs wptb-sides-controls-wrapper",class:{"wptb-side-values-linked":e.linkValues}},[e._l(e.sideValues,function(s,i){return t("side-input",{key:i,attrs:{label:e.strings[i]},on:{changedFromFront:e.inputChanged},model:{value:e.sideValues[i],callback:function(s){e.$set(e.sideValues,i,s)},expression:"sideValues[k]"}})}),e._v(" "),t("side-dropdown",{model:{value:e.type,callback:function(s){e.type=s},expression:"type"}})],2)])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
112 |
},{"../mixins/ControlBase":"LTB1","../components/SideInput":"n7p4","../components/SideDropdown":"VsoX"}],"Qbmt":[function(require,module,exports) {
|
113 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("vue")),t=n(require("../functions/WPTB_ControlsManager")),r=n(require("../containers/SidesControl")),o=n(require("../plugins/filters"));function n(e){return e&&e.__esModule?e:{default:e}}var u={name:"ControlSides",handler:function(n){var u=t.default.getControlData(n);e.default.use(o.default),new e.default({data:u,components:{SidesControl:r.default}}).$mount("#".concat(n))}};exports.default=u;
|
114 |
+
},{"vue":"HYXJ","../functions/WPTB_ControlsManager":"WZJa","../containers/SidesControl":"ouPJ","../plugins/filters":"GZC0"}],"Igda":[function(require,module,exports) {
|
115 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={props:{title:{type:String,default:"item"},id:{type:String,required:!0},active:{type:Boolean,default:!1}},watch:{active:function(t){!0===t&&this.$emit("activateItem",this.id,this.$refs.itemWrapper)}},methods:{activateItem:function(t){this.$emit("activateItem",this.id,t.target)}}};exports.default=t;
|
116 |
+
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{ref:"itemWrapper",staticClass:"wptb-named-toggle-item",attrs:{"data-wptb-named-toggle-active":t.active},on:{"!click":function(e){return e.preventDefault(),t.activateItem(e)}}},[t._v(" "+t._s(t.title)+"\n")])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
117 |
+
},{}],"Cqv2":[function(require,module,exports) {
|
118 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t={props:{refElement:{type:HTMLElement,default:null}},data:function(){return{style:{left:0,top:0,width:0}}},watch:{refElement:function(t){null!=t&&this.calculatePosition()}},methods:{calculatePosition:function(){var t=this.$refs.main.parentNode.getBoundingClientRect(),e=this.refElement.getBoundingClientRect(),n=e.x-t.x;this.style.left="".concat(Math.floor(n-1),"px"),this.style.width="".concat(e.width+1,"px")}}};exports.default=t;
|
119 |
+
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this.$createElement;return(this._self._c||t)("div",{ref:"main",staticClass:"wptb-named-toggle-active-indicator",style:this.style})},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
120 |
+
},{}],"rI0T":[function(require,module,exports) {
|
121 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=i(require("../mixins/ControlBase")),t=i(require("../components/NamedToggleItem")),n=i(require("../components/NamedToggleActiveIndicator"));function i(e){return e&&e.__esModule?e:{default:e}}var a={components:{NamedToggleActiveIndicator:n.default,NamedToggleItem:t.default},props:{items:{type:Object,default:function(){return{item:"item"}}}},mixins:[e.default],data:function(){return{activeElement:null}},mounted:function(){this.assignDefaultValue()},watch:{elementMainValue:function(e){this.setAllValues(e),this.generateChangeEvent(e),this.setTableDirty(!0)}},methods:{isItemActive:function(e){return this.elementMainValue===e},activateItem:function(e,t){this.elementMainValue=e,this.activeElement=t}}};exports.default=a;
|
122 |
+
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"wptb-settings-row wptb-settings-middle-xs wptb-element-property",class:t.uniqueId,attrs:{"data-element":t.elemContainer}},[s("div",{staticClass:"wptb-settings-space-between"},[s("p",{staticClass:"wptb-settings-item-title"},[t._v(t._s(t.label))]),t._v(" "),s("div",{staticClass:"wptb-named-toggle-control-wrapper"},[s("named-toggle-active-indicator",{attrs:{"ref-element":t.activeElement}}),t._v(" "),t._l(t.items,function(e,i){return s("named-toggle-item",{key:i,attrs:{title:e,id:i,active:t.isItemActive(i)},on:{activateItem:t.activateItem}})})],2)])])},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
123 |
+
},{"../mixins/ControlBase":"LTB1","../components/NamedToggleItem":"Igda","../components/NamedToggleActiveIndicator":"Cqv2"}],"mWd1":[function(require,module,exports) {
|
124 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("vue")),t=r(require("../functions/WPTB_ControlsManager")),o=r(require("../containers/NamedToggleControl"));function r(e){return e&&e.__esModule?e:{default:e}}var a={name:"ControlNamedToggle",handler:function(r){var a=t.default.getControlData(r);new e.default({data:a,components:{NamedToggleControl:o.default}}).$mount("#".concat(r))}};exports.default=a;
|
125 |
+
},{"vue":"HYXJ","../functions/WPTB_ControlsManager":"WZJa","../containers/NamedToggleControl":"rI0T"}],"Zn1h":[function(require,module,exports) {
|
126 |
|
127 |
+
"use strict";var e=d(require("vue")),t=d(require("./mountPoints/WPTB_IconSelectControl")),o=d(require("./mountPoints/WPTB_RangeControl")),n=d(require("./mountPoints/WPTB_Select2Control")),r=d(require("./mountPoints/WPTB_MediaSelectControl")),u=d(require("./functions/WPTB_ControlsManager")),l=d(require("./mountPoints/WPTB_ResponsiveTable")),i=d(require("./mountPoints/WPTB_SidesControl")),a=d(require("./mountPoints/WPTB_NamedToggleControl"));function d(e){return e&&e.__esModule?e:{default:e}}e.default.config.productionTip=!1;var f=self||void 0;f.WPTB_ControlsManager=u.default;var s=[t.default,o.default,u.default,n.default,r.default,l.default,i.default,a.default];function P(e){u.default.addControlScript(e.name,e.handler)}s.map(P);
|
128 |
+
},{"vue":"HYXJ","./mountPoints/WPTB_IconSelectControl":"Pn7d","./mountPoints/WPTB_RangeControl":"YVYX","./mountPoints/WPTB_Select2Control":"eNVe","./mountPoints/WPTB_MediaSelectControl":"Uwhc","./functions/WPTB_ControlsManager":"WZJa","./mountPoints/WPTB_ResponsiveTable":"Ub7O","./mountPoints/WPTB_SidesControl":"Qbmt","./mountPoints/WPTB_NamedToggleControl":"mWd1"}]},{},["Zn1h"], null)
|
inc/admin/js/WPTB_Import_Menu.js
CHANGED
@@ -30,7 +30,7 @@ var e=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
30 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{center:{type:Boolean,default:!1}}};exports.default=e;
|
31 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"wptb-settings-controls-wrapper",class:[this.center?"center":"grid"]},[e("transition",{attrs:{name:"wptb-fade",mode:"out-in"}},[this._t("default")],2)],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
32 |
},{}],"vU4o":[function(require,module,exports) {
|
33 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var
|
34 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"wptb-menu-file-drop",class:e.eventClass,on:{dragenter:function(t){t.stopPropagation(),t.preventDefault(),e.dragActive=!0},dragleave:function(t){t.stopPropagation(),t.preventDefault(),e.dragActive=!1},drop:function(t){return t.stopPropagation(),t.preventDefault(),e.handleDrop(t)},dragover:function(t){t.stopPropagation(),t.preventDefault(),e.dragActive=!0}}},[n("transition",{attrs:{name:"wptb-fade",mode:"out-in"}},[e.dragActive?n("div",{key:"fileLogo",staticClass:"file-icon"},[n("span",{staticClass:"dashicons dashicons-media-spreadsheet"})]):n("div",{key:"controls"},[n("transition",{attrs:{name:"wptb-fade",mode:"out-in"}},[null===e.currentFile?n("div",{key:"selection",staticClass:"wptb-flex wptb-flex-col wptb-flex-align-center"},[n("div",{staticClass:"hint"},[e._v(e._s(e.texts.hint))]),e._v(" "),n("div",{staticClass:"supported wptb-text-transform-none"},[e._v("("+e._s(e.allowedFormats.join(", "))+")")]),e._v(" "),n("div",[n("a",{on:{click:function(t){return t.preventDefault(),e.openFileSelect(t)}}},[e._v(e._s(e.texts.browse))]),e._v(" "),n("input",{ref:"fileSelect",staticStyle:{display:"none"},attrs:{type:"file"},on:{change:e.handleFileSelect}})])]):n("div",{key:"selected",staticClass:"wptb-flex wptb-flex-col wptb-flex-align-center"},[n("div",{staticClass:"file"},[e._v(e._s(e.currentFile.name))]),e._v(" "),n("div",[n("a",{on:{click:function(t){return t.preventDefault(),e.clearCurrentFile(t)}}},[e._v(e._s(e.texts.clear))])])])])],1)])],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
35 |
},{}],"yXWm":[function(require,module,exports) {
|
36 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:["fieldData","modelBind"],methods:{isType:function(e){return this.fieldData.type===e}}};exports.default=e;
|
30 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:{center:{type:Boolean,default:!1}}};exports.default=e;
|
31 |
(function(){var t=exports.default||module.exports;"function"==typeof t&&(t=t.options),Object.assign(t,{render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"wptb-settings-controls-wrapper",class:[this.center?"center":"grid"]},[e("transition",{attrs:{name:"wptb-fade",mode:"out-in"}},[this._t("default")],2)],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
32 |
},{}],"vU4o":[function(require,module,exports) {
|
33 |
+
"use strict";function e(e,n){return l(e)||i(e,n)||r(e,n)||t()}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,i=!1,l=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(u){i=!0,l=u}finally{try{n||null==a.return||a.return()}finally{if(i)throw l}}return r}}function l(e){if(Array.isArray(e))return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var o={props:["texts","file","allowedFormats"],model:{prop:"file",event:"fileChanged"},data:function(){return{dragActive:!1,currentFile:null}},mounted:function(){this.currentFile=this.file},watch:{currentFile:function(e){this.$emit("fileChanged",e)},file:function(e){this.currentFile=e}},computed:{eventClass:function(){return this.dragActive?"dragenter":""}},methods:{handleDrop:function(t){this.dragActive=!0;var r=t.dataTransfer;if(r.files[0]&&this.isTypeAllowed(r.files[0])){var n=e(r.files,1);this.currentFile=n[0]}this.dragActive=!1},isTypeAllowed:function(e){var t=e.name.split(".").pop();return this.allowedFormats.includes(t)},openFileSelect:function(){this.$refs.fileSelect.click()},handleFileSelect:function(t){if(t.target.files.length>0&&this.isTypeAllowed(t.target.files[0])){var r=e(t.target.files,1);this.currentFile=r[0]}},clearCurrentFile:function(){this.currentFile=null}}};exports.default=o;
|
34 |
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"wptb-menu-file-drop",class:e.eventClass,on:{dragenter:function(t){t.stopPropagation(),t.preventDefault(),e.dragActive=!0},dragleave:function(t){t.stopPropagation(),t.preventDefault(),e.dragActive=!1},drop:function(t){return t.stopPropagation(),t.preventDefault(),e.handleDrop(t)},dragover:function(t){t.stopPropagation(),t.preventDefault(),e.dragActive=!0}}},[n("transition",{attrs:{name:"wptb-fade",mode:"out-in"}},[e.dragActive?n("div",{key:"fileLogo",staticClass:"file-icon"},[n("span",{staticClass:"dashicons dashicons-media-spreadsheet"})]):n("div",{key:"controls"},[n("transition",{attrs:{name:"wptb-fade",mode:"out-in"}},[null===e.currentFile?n("div",{key:"selection",staticClass:"wptb-flex wptb-flex-col wptb-flex-align-center"},[n("div",{staticClass:"hint"},[e._v(e._s(e.texts.hint))]),e._v(" "),n("div",{staticClass:"supported wptb-text-transform-none"},[e._v("("+e._s(e.allowedFormats.join(", "))+")")]),e._v(" "),n("div",[n("a",{on:{click:function(t){return t.preventDefault(),e.openFileSelect(t)}}},[e._v(e._s(e.texts.browse))]),e._v(" "),n("input",{ref:"fileSelect",staticStyle:{display:"none"},attrs:{type:"file"},on:{change:e.handleFileSelect}})])]):n("div",{key:"selected",staticClass:"wptb-flex wptb-flex-col wptb-flex-align-center"},[n("div",{staticClass:"file"},[e._v(e._s(e.currentFile.name))]),e._v(" "),n("div",[n("a",{on:{click:function(t){return t.preventDefault(),e.clearCurrentFile(t)}}},[e._v(e._s(e.texts.clear))])])])])],1)])],1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
|
35 |
},{}],"yXWm":[function(require,module,exports) {
|
36 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={props:["fieldData","modelBind"],methods:{isType:function(e){return this.fieldData.type===e}}};exports.default=e;
|
inc/admin/js/WPTB_ResponsiveFrontend.js
CHANGED
@@ -681,8 +681,8 @@
|
|
681 |
* Bind rebuilding of tables to window resize event.
|
682 |
*/
|
683 |
this.bindRebuildToResize = () => {
|
684 |
-
window.addEventListener('resize', (
|
685 |
-
this.rebuildTables(
|
686 |
});
|
687 |
};
|
688 |
|
@@ -1163,13 +1163,34 @@
|
|
1163 |
* @param {number} size screen size
|
1164 |
*/
|
1165 |
this.rebuildTables = (size) => {
|
1166 |
-
if (!size) {
|
1167 |
-
// eslint-disable-next-line no-param-reassign
|
1168 |
-
size = window.innerWidth;
|
1169 |
-
}
|
1170 |
// eslint-disable-next-line array-callback-return
|
1171 |
this.elementObjects.map((o) => {
|
1172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1173 |
});
|
1174 |
};
|
1175 |
|
681 |
* Bind rebuilding of tables to window resize event.
|
682 |
*/
|
683 |
this.bindRebuildToResize = () => {
|
684 |
+
window.addEventListener('resize', () => {
|
685 |
+
this.rebuildTables();
|
686 |
});
|
687 |
};
|
688 |
|
1163 |
* @param {number} size screen size
|
1164 |
*/
|
1165 |
this.rebuildTables = (size) => {
|
|
|
|
|
|
|
|
|
1166 |
// eslint-disable-next-line array-callback-return
|
1167 |
this.elementObjects.map((o) => {
|
1168 |
+
let innerSize = size;
|
1169 |
+
if (!size) {
|
1170 |
+
// eslint-disable-next-line no-param-reassign
|
1171 |
+
innerSize = window.innerWidth;
|
1172 |
+
|
1173 |
+
const directives = this.getDirective(o.el);
|
1174 |
+
// calculate size according to relative width directive
|
1175 |
+
if (directives && directives.relativeWidth) {
|
1176 |
+
switch (directives.relativeWidth) {
|
1177 |
+
case 'window':
|
1178 |
+
// eslint-disable-next-line no-param-reassign
|
1179 |
+
innerSize = window.innerWidth;
|
1180 |
+
break;
|
1181 |
+
case 'container':
|
1182 |
+
// get the size of the container table is in
|
1183 |
+
// eslint-disable-next-line no-param-reassign
|
1184 |
+
innerSize = o.el.parentNode.parentNode.parentNode.clientWidth;
|
1185 |
+
break;
|
1186 |
+
default:
|
1187 |
+
// eslint-disable-next-line no-param-reassign
|
1188 |
+
innerSize = window.innerWidth;
|
1189 |
+
break;
|
1190 |
+
}
|
1191 |
+
}
|
1192 |
+
}
|
1193 |
+
this.rebuildTable(o.el, innerSize, o.tableObject);
|
1194 |
});
|
1195 |
};
|
1196 |
|
inc/admin/js/admin.js
CHANGED
@@ -1,95 +1,5 @@
|
|
1 |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2 |
|
3 |
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
4 |
-
|
5 |
-
var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
|
6 |
-
var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
7 |
-
|
8 |
-
var node = element.getDOMElement(),
|
9 |
-
index,
|
10 |
-
copy;
|
11 |
-
if (node.classList.contains('wptb-ph-element')) {
|
12 |
-
if (kindIndexProt == undefined || copy == true) {
|
13 |
-
//index = document.counter.nextIndex( element.kind );
|
14 |
-
var wptbElements = document.getElementsByClassName('wptb-ph-element');
|
15 |
-
var elementIndexesArr = [];
|
16 |
-
for (var i = 0; i < wptbElements.length; i++) {
|
17 |
-
var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
|
18 |
-
var infArr = wptbElements[i].className.match(regex);
|
19 |
-
if (infArr) {
|
20 |
-
elementIndexesArr.push(infArr[1]);
|
21 |
-
}
|
22 |
-
}
|
23 |
-
if (elementIndexesArr.length > 0) {
|
24 |
-
var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
|
25 |
-
index = elementIndexMax + 1;
|
26 |
-
} else {
|
27 |
-
index = 1;
|
28 |
-
}
|
29 |
-
|
30 |
-
if (copy) {
|
31 |
-
// change all data-elements which save parameters for different controls
|
32 |
-
var wptbNodeattributes = [].concat(_toConsumableArray(node.attributes));
|
33 |
-
for (var _i = 0; _i < wptbNodeattributes.length; _i++) {
|
34 |
-
if (wptbNodeattributes[_i] && _typeof(wptbNodeattributes[_i]) === 'object' && wptbNodeattributes[_i].nodeName) {
|
35 |
-
var regularText = new RegExp('data-wptb-el-' + element.kind + '-(\\d+)-([a-zA-Z0-9_-]+)', "i");
|
36 |
-
var attr = wptbNodeattributes[_i].nodeName.match(regularText);
|
37 |
-
if (attr && Array.isArray(attr)) {
|
38 |
-
var newDataAttributeName = wptbNodeattributes[_i].nodeName.replace(element.kind + '-' + attr[1], element.kind + '-' + index);
|
39 |
-
var newDataAttributeValue = wptbNodeattributes[_i].nodeValue;
|
40 |
-
node.removeAttribute(wptbNodeattributes[_i].nodeName);
|
41 |
-
node.setAttribute(newDataAttributeName, newDataAttributeValue);
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}
|
46 |
-
} else if (kindIndexProt && !copy) {
|
47 |
-
var kindIndexProtArr = kindIndexProt.split('-');
|
48 |
-
index = kindIndexProtArr[kindIndexProtArr.length - 1];
|
49 |
-
// start element javascript if element is new
|
50 |
-
}
|
51 |
-
|
52 |
-
var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
|
53 |
-
if (node_wptb_element_kind_num) {
|
54 |
-
node.classList.remove(node_wptb_element_kind_num[0]);
|
55 |
-
}
|
56 |
-
if (!node.classList.contains('wptb-ph-element')) {
|
57 |
-
node.classList.add('wptb-ph-element');
|
58 |
-
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
59 |
-
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
60 |
-
}
|
61 |
-
} else {
|
62 |
-
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
63 |
-
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
64 |
-
}
|
65 |
-
}
|
66 |
-
WPTB_Helper.elementStartScript(element.getDOMElement());
|
67 |
-
new WPTB_ElementOptions(element, index, kindIndexProt);
|
68 |
-
document.counter.increment(element.kind);
|
69 |
-
}
|
70 |
-
|
71 |
-
node.onmouseenter = function (event) {
|
72 |
-
if (event.target.classList.contains('wptb-moving-mode')) {
|
73 |
-
return;
|
74 |
-
}
|
75 |
-
|
76 |
-
var wptbActionsField = new WPTB_ActionsField();
|
77 |
-
|
78 |
-
wptbActionsField.addActionField(1, node);
|
79 |
-
|
80 |
-
wptbActionsField.setParameters(node);
|
81 |
-
|
82 |
-
node.classList.remove('wptb-ondragenter');
|
83 |
-
};
|
84 |
-
|
85 |
-
node.onmouseleave = function (event) {
|
86 |
-
var wptbActionsField = new WPTB_ActionsField();
|
87 |
-
|
88 |
-
wptbActionsField.leaveFromField(event, node);
|
89 |
-
};
|
90 |
-
};
|
91 |
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
92 |
-
|
93 |
var WPTB_ActionsField = function WPTB_ActionsField() {
|
94 |
var _this = this;
|
95 |
|
@@ -164,6 +74,8 @@ var WPTB_ActionsField = function WPTB_ActionsField() {
|
|
164 |
|
165 |
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
166 |
wptbTableStateSaveManager.tableStateSet();
|
|
|
|
|
167 |
};
|
168 |
|
169 |
btnCopy.onclick = function (event) {
|
@@ -1629,84 +1541,151 @@ var WPTB_Helper = {
|
|
1629 |
}, false);
|
1630 |
}
|
1631 |
},
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1636 |
var infArr = targetControlElementClass.match(/wptb-el-((.+-)\d+)-(.+)/i);
|
1637 |
-
|
|
|
1638 |
if (infArr && Array.isArray(infArr)) {
|
1639 |
var controlName = infArr[3];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1640 |
|
1641 |
-
|
|
|
1642 |
|
1643 |
-
|
|
|
1644 |
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1651 |
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
controlContainerElem.style.display = 'block';
|
1690 |
-
var childCheck = controlContainerElem.querySelector('input[type="checkbox"]');
|
1691 |
-
if (childCheck) {
|
1692 |
-
childCheck.checked = true;
|
1693 |
-
}
|
1694 |
-
} else if (dependOn[2] && Array.isArray(dependOn[2]) && dependOn[2].indexOf(targetControlValue) !== -1) {
|
1695 |
-
controlContainerElem.style.display = 'none';
|
1696 |
-
}
|
1697 |
-
}
|
1698 |
-
}
|
1699 |
-
};
|
1700 |
|
1701 |
-
|
|
|
1702 |
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
|
|
|
|
1706 |
}
|
1707 |
}
|
1708 |
}
|
1709 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1710 |
}
|
1711 |
},
|
1712 |
//
|
@@ -1893,7 +1872,7 @@ var WPTB_Helper = {
|
|
1893 |
}
|
1894 |
},
|
1895 |
//
|
1896 |
-
elementOptionsSet: function elementOptionsSet(kind, element) {
|
1897 |
// get controls config for this element
|
1898 |
var wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';
|
1899 |
var tmplControlsConfig = wp.template(wptbContrlStacksConfigId);
|
@@ -1926,6 +1905,20 @@ var WPTB_Helper = {
|
|
1926 |
data = {
|
1927 |
container: '.' + infArr[0]
|
1928 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1929 |
|
1930 |
elementContainerClass = infArr[0];
|
1931 |
elementOptionClassIndic = infArr[1];
|
@@ -1940,18 +1933,11 @@ var WPTB_Helper = {
|
|
1940 |
for (var _i4 = 0; _i4 < children.length; _i4++) {
|
1941 |
if (children[_i4].style) children[_i4].style.display = 'none';
|
1942 |
}
|
1943 |
-
|
1944 |
-
// hide wptb-elements-container and wptb-settings-section
|
1945 |
-
// document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'none';
|
1946 |
-
// document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'none';
|
1947 |
-
|
1948 |
-
// show element-options-group
|
1949 |
-
// document.getElementById( 'element-options-group' ).style.display = 'block';
|
1950 |
this.activateSection('options_group');
|
1951 |
}
|
1952 |
|
1953 |
-
var
|
1954 |
-
var
|
1955 |
|
1956 |
var elementOptionsGroupIdsInvolved = [],
|
1957 |
elementOptionsGroupInvolved = {},
|
@@ -1960,14 +1946,22 @@ var WPTB_Helper = {
|
|
1960 |
// object for save all scrips for each controls
|
1961 |
var controlScriptsObj = {};
|
1962 |
|
1963 |
-
// array for keep "appear depend on"
|
1964 |
var controlappearDependOnControl = [];
|
1965 |
|
|
|
|
|
|
|
1966 |
// create controls
|
1967 |
var elementOptionsScriptsContainerIndic = false;
|
|
|
|
|
|
|
|
|
|
|
1968 |
var i = 0;
|
1969 |
-
Object.keys(
|
1970 |
-
var data =
|
1971 |
data.controlKey = key;
|
1972 |
|
1973 |
// get necessary wp js template
|
@@ -1975,6 +1969,11 @@ var WPTB_Helper = {
|
|
1975 |
|
1976 |
data.elemContainer = elementContainerClass;
|
1977 |
data.elementControlTargetUnicClass = 'wptb-el-' + elementOptionClassIndic + '-' + data.controlKey;
|
|
|
|
|
|
|
|
|
|
|
1978 |
var controlTemplate = tmplControlTemplate(data);
|
1979 |
if ('appearDependOnControl' in data) {
|
1980 |
if (Array.isArray(data.appearDependOnControl)) {
|
@@ -1982,6 +1981,12 @@ var WPTB_Helper = {
|
|
1982 |
}
|
1983 |
}
|
1984 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1985 |
function elementOptionsContainerInvolvedGet(elementOptionsGroupId, elementOptionsContainerInvolved) {
|
1986 |
if (!elementOptionsContainerInvolved[elementOptionsGroupId]) {
|
1987 |
var elementOptionsContainer = document.createElement('div');
|
@@ -1993,7 +1998,7 @@ var WPTB_Helper = {
|
|
1993 |
return elementOptionsContainerInvolved[elementOptionsGroupId];
|
1994 |
}
|
1995 |
|
1996 |
-
if (elementOptionsGroupIdsInvolved.indexOf(data.elementOptionsGroupId) == -1) {
|
1997 |
elementOptionsGroupIdsInvolved.push(data.elementOptionsGroupId);
|
1998 |
// clear elements from options group
|
1999 |
//document.getElementById( 'element-options-group' ).innerHTML = '';
|
@@ -2007,7 +2012,7 @@ var WPTB_Helper = {
|
|
2007 |
|
2008 |
controlElementParent = elementOptionsGroupInvolved[data.elementOptionsGroupId];
|
2009 |
|
2010 |
-
if (data.elementOptionsContainerOn === 'true') {
|
2011 |
controlElementParent = elementOptionsContainerInvolvedGet(data.elementOptionsGroupId, elementOptionsContainerInvolved);
|
2012 |
}
|
2013 |
|
@@ -2023,8 +2028,21 @@ var WPTB_Helper = {
|
|
2023 |
elementOptionContainer.setAttribute('style', data.containerAdditionalStyles);
|
2024 |
}
|
2025 |
|
2026 |
-
|
|
|
|
|
|
|
|
|
2027 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2028 |
controlElementParent = elementOptionContainer;
|
2029 |
}
|
2030 |
controlElementParent.innerHTML = controlElementParent.innerHTML + controlTemplate;
|
@@ -2036,6 +2054,7 @@ var WPTB_Helper = {
|
|
2036 |
controlElementParent.removeChild(helperJavascriptElem);
|
2037 |
var script = document.createElement('script');
|
2038 |
script.setAttribute('type', 'text/javascript');
|
|
|
2039 |
script.innerHTML = helperJavascriptCode.replace(/\r|\n|\t/g, '').trim();
|
2040 |
if (!controlScriptsObj[data.elementOptionsGroupId] || !Array.isArray(controlScriptsObj[data.elementOptionsGroupId])) {
|
2041 |
controlScriptsObj[data.elementOptionsGroupId] = [];
|
@@ -2049,26 +2068,63 @@ var WPTB_Helper = {
|
|
2049 |
element.optionsGroupIds = elementOptionsGroupIdsInvolved;
|
2050 |
|
2051 |
Object.keys(controlScriptsObj).forEach(function (elementOptionsGroupId) {
|
|
|
|
|
|
|
|
|
|
|
|
|
2052 |
var controlScriptsArr = controlScriptsObj[elementOptionsGroupId];
|
2053 |
-
elementOptionsScriptsContainer = document.createElement('div');
|
2054 |
-
elementOptionsScriptsContainer.classList.add('wptb-element-options-scripts', 'wptb-options-' + infArr[1]);
|
2055 |
-
elementOptionsGroupInvolved[elementOptionsGroupId].appendChild(elementOptionsScriptsContainer);
|
2056 |
if (controlScriptsArr.length > 0) {
|
2057 |
for (var _i6 = 0; _i6 < controlScriptsArr.length; _i6++) {
|
2058 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2059 |
}
|
2060 |
}
|
2061 |
});
|
2062 |
|
2063 |
// run the scripts of controls
|
2064 |
|
2065 |
-
|
2066 |
// run appearDependOnControl function
|
2067 |
for (var _i7 = 0; _i7 < controlappearDependOnControl.length; _i7++) {
|
2068 |
WPTB_Helper.appearDependOnControl(controlappearDependOnControl[_i7][0], controlappearDependOnControl[_i7][1]);
|
2069 |
}
|
2070 |
|
2071 |
WPTB_Helper.wptbDocumentEventGenerate('element:controls:active', element);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2072 |
},
|
2073 |
|
2074 |
/**
|
@@ -2087,9 +2143,9 @@ var WPTB_Helper = {
|
|
2087 |
if (table.length > 0) {
|
2088 |
table = table[0];
|
2089 |
|
2090 |
-
var
|
2091 |
-
if (
|
2092 |
-
selector = '.' +
|
2093 |
}
|
2094 |
}
|
2095 |
}
|
@@ -2640,8 +2696,8 @@ var WPTB_Helper = {
|
|
2640 |
wptbPreviewTable.parentNode.classList.remove('wptb-preview-table-manage-cells');
|
2641 |
var wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName('td');
|
2642 |
if (wptbPreviewTableTds.length > 0) {
|
2643 |
-
for (var
|
2644 |
-
wptbPreviewTableTds[
|
2645 |
}
|
2646 |
}
|
2647 |
toggleEditMode = 'closed';
|
@@ -2781,11 +2837,16 @@ var WPTB_Helper = {
|
|
2781 |
getValueMaxCountSameElementsInArray: function getValueMaxCountSameElementsInArray(arr) {
|
2782 |
if (arr && Array.isArray(arr)) {
|
2783 |
var check = {};
|
|
|
2784 |
for (var i = 0; i < arr.length; i++) {
|
2785 |
-
if (
|
2786 |
-
check[arr[i]]
|
|
|
|
|
|
|
|
|
2787 |
} else {
|
2788 |
-
|
2789 |
}
|
2790 |
}
|
2791 |
|
@@ -2801,7 +2862,7 @@ var WPTB_Helper = {
|
|
2801 |
}
|
2802 |
}
|
2803 |
|
2804 |
-
return maxPropName;
|
2805 |
}
|
2806 |
},
|
2807 |
|
@@ -2859,10 +2920,10 @@ var WPTB_Helper = {
|
|
2859 |
}
|
2860 |
}
|
2861 |
jMainIter++;
|
|
|
2862 |
|
2863 |
-
|
2864 |
-
|
2865 |
-
}
|
2866 |
}
|
2867 |
|
2868 |
if (i == 0) {
|
@@ -2932,193 +2993,120 @@ var WPTB_Helper = {
|
|
2932 |
// get drag relative type
|
2933 |
getDragRelativeType: function getDragRelativeType() {
|
2934 |
return this.dragRelativeType;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2935 |
}
|
2936 |
};
|
2937 |
var WPTB_Initializer = function WPTB_Initializer() {
|
2938 |
|
2939 |
-
|
2940 |
-
|
2941 |
-
|
2942 |
-
|
2943 |
|
2944 |
-
|
2945 |
-
|
2946 |
|
2947 |
-
|
2948 |
-
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
|
2953 |
-
|
2954 |
-
|
2955 |
-
|
2956 |
-
|
2957 |
-
|
2958 |
|
2959 |
-
|
2960 |
-
|
2961 |
-
|
2962 |
-
|
2963 |
-
|
2964 |
|
2965 |
-
|
2966 |
-
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
2970 |
|
2971 |
-
|
2972 |
-
|
2973 |
-
|
2974 |
|
2975 |
-
|
2976 |
|
2977 |
-
|
2978 |
|
2979 |
-
|
2980 |
-
|
2981 |
-
|
|
|
|
|
|
|
|
|
2982 |
|
2983 |
-
|
2984 |
-
|
2985 |
-
WPTB_Helper.setupSectionButtons();
|
2986 |
|
2987 |
-
|
2988 |
-
|
|
|
2989 |
|
2990 |
-
|
2991 |
-
|
2992 |
-
WPTB_Helper.setupSidebarToggle('.wptb-panel-toggle-section .wptb-panel-drawer-icon');
|
2993 |
|
2994 |
-
|
2995 |
-
|
2996 |
|
2997 |
-
|
2998 |
-
|
2999 |
|
3000 |
-
|
3001 |
-
|
|
|
|
|
|
|
3002 |
};
|
3003 |
-
var
|
3004 |
|
3005 |
-
|
3006 |
-
|
3007 |
-
if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
|
3008 |
-
return;
|
3009 |
-
}
|
3010 |
-
WPTB_DropHandle(this, e);
|
3011 |
|
3012 |
-
|
3013 |
-
|
3014 |
-
|
3015 |
-
|
3016 |
-
|
3017 |
-
};
|
3018 |
-
element.ondragleave = function (e) {
|
3019 |
-
WPTB_DropHandle(this, e, true);
|
3020 |
-
};
|
3021 |
-
element.ondrop = function (e) {
|
3022 |
-
this.classList.remove('wptb-ondragenter');
|
3023 |
-
var element = void 0,
|
3024 |
-
classId = void 0;
|
3025 |
-
e.preventDefault();
|
3026 |
-
e.stopPropagation();
|
3027 |
-
|
3028 |
-
if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
|
3029 |
-
return;
|
3030 |
-
}
|
3031 |
-
var wptbDropHandle = void 0,
|
3032 |
-
wptbDropBorderMarker = void 0;
|
3033 |
-
if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
|
3034 |
-
wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
|
3035 |
-
}
|
3036 |
-
if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
|
3037 |
-
wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
|
3038 |
-
}
|
3039 |
-
|
3040 |
-
if (e.dataTransfer.getData('wptbElement')) {
|
3041 |
-
element = WPTB_Helper.newElementProxy(e.dataTransfer.getData('wptbElement'));
|
3042 |
-
element = element.getDOMElement();
|
3043 |
-
} else {
|
3044 |
-
classId = e.dataTransfer.getData('node');
|
3045 |
-
element = document.getElementsByClassName(classId)[0];
|
3046 |
-
//element.classList.remove( 'wptb-moving-mode' );
|
3047 |
-
}
|
3048 |
-
|
3049 |
-
if (WPTB_Helper.getDragRelativeType() === 'td_relative') {
|
3050 |
-
WPTB_DropHandle(this, e, true);
|
3051 |
-
var parentCell = WPTB_Helper.getParentOfType('td', e.target);
|
3052 |
-
|
3053 |
-
parentCell.appendChild(element);
|
3054 |
-
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
3055 |
-
} else if (wptbDropHandle.style.display == 'block') {
|
3056 |
-
var td = void 0;
|
3057 |
-
if (wptbDropHandle.dataset.text == 'Drop Here') {
|
3058 |
-
td = wptbDropHandle.getDOMParentElement();
|
3059 |
-
td.appendChild(element);
|
3060 |
-
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
3061 |
-
} else {
|
3062 |
-
var innerElement = wptbDropHandle.getDOMParentElement();
|
3063 |
-
td = innerElement.parentNode;
|
3064 |
-
|
3065 |
-
if (wptbDropHandle.dataset.text == 'Above Element') {
|
3066 |
-
td.insertBefore(element, innerElement);
|
3067 |
-
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
3068 |
-
} else if (wptbDropHandle.dataset.text == 'Below Element') {
|
3069 |
-
var innerElementNext = innerElement.nextSibling;
|
3070 |
-
td.insertBefore(element, innerElementNext);
|
3071 |
-
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
3072 |
-
}
|
3073 |
-
}
|
3074 |
-
|
3075 |
-
var thisRow = td.parentNode;
|
3076 |
-
if (WPTB_Helper.rowIsTop(thisRow)) {
|
3077 |
-
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
3078 |
-
|
3079 |
-
if (table.classList.contains('wptb-table-preview-head')) {
|
3080 |
-
WPTB_Helper.dataTitleColumnSet(table);
|
3081 |
-
}
|
3082 |
-
}
|
3083 |
-
|
3084 |
-
// start item javascript if item is new
|
3085 |
-
var infArr = element.className.match(/wptb-element-(.+)-(\d+)/i);
|
3086 |
-
var elemKind = infArr[1];
|
3087 |
-
if (e.dataTransfer.getData('wptbElement') && (elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list')) {
|
3088 |
-
//WPTB_Helper.elementStartScript( element );
|
3089 |
-
}
|
3090 |
-
} else {
|
3091 |
-
return;
|
3092 |
-
}
|
3093 |
-
|
3094 |
-
if (wptbDropHandle) {
|
3095 |
-
wptbDropHandle.style.display = 'none';
|
3096 |
-
wptbDropBorderMarker.style.display = 'none';
|
3097 |
-
}
|
3098 |
-
|
3099 |
-
WPTB_innerElementSet(element);
|
3100 |
-
|
3101 |
-
if (!element.classList.contains('wptb-image-container') || element.classList.contains('wptb-moving-mode')) {
|
3102 |
-
element.classList.remove('wptb-moving-mode');
|
3103 |
-
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
3104 |
-
wptbTableStateSaveManager.tableStateSet();
|
3105 |
-
}
|
3106 |
-
return true;
|
3107 |
-
};
|
3108 |
-
element.onmouseover = function (e) {
|
3109 |
-
element.classList.remove('wptb-ondragenter');
|
3110 |
-
};
|
3111 |
-
};
|
3112 |
-
var WPTB_LeftPanel = function WPTB_LeftPanel() {
|
3113 |
-
|
3114 |
-
var table = document.getElementsByClassName('wptb-preview-table')[0],
|
3115 |
-
wptbElementButtons = document.getElementsByClassName('wptb-element');
|
3116 |
-
|
3117 |
-
for (var i = 0; i < wptbElementButtons.length; i++) {
|
3118 |
-
wptbElementButtons[i].ondragstart = function (e) {
|
3119 |
-
e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);
|
3120 |
-
e.dataTransfer.setData('wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement);
|
3121 |
-
};
|
3122 |
};
|
3123 |
|
3124 |
if (table) {
|
@@ -3126,18 +3114,6 @@ var WPTB_LeftPanel = function WPTB_LeftPanel() {
|
|
3126 |
for (var _i = 0; _i < wptbTablesEditModeCloseButton.length; _i++) {
|
3127 |
wptbTablesEditModeCloseButton[_i].onclick = WPTB_Helper.toggleTableEditMode;
|
3128 |
}
|
3129 |
-
document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;
|
3130 |
-
document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;
|
3131 |
-
document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;
|
3132 |
-
document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;
|
3133 |
-
document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;
|
3134 |
-
document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;
|
3135 |
-
document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;
|
3136 |
-
document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;
|
3137 |
-
document.getElementById('wptb-delete-column').onclick = table.deleteColumn;
|
3138 |
-
document.getElementById('wptb-delete-row').onclick = table.deleteRow;
|
3139 |
-
document.getElementById('wptb-merge-cells').onclick = table.mergeCells;
|
3140 |
-
document.getElementById('wptb-split-cell').onclick = table.splitCell;
|
3141 |
};
|
3142 |
|
3143 |
// this code hides the "element parameters" area
|
@@ -4458,6 +4434,7 @@ var array = [],
|
|
4458 |
td.getDOMElement().setAttribute('style', currentTdStyle);
|
4459 |
td.getDOMElement().style.width = null;
|
4460 |
td.getDOMElement().style.height = null;
|
|
|
4461 |
}
|
4462 |
|
4463 |
table.rows[i].appendChild(td.getDOMElement());
|
@@ -4501,6 +4478,7 @@ var array = [],
|
|
4501 |
td.getDOMElement().setAttribute('style', currentTdStyle);
|
4502 |
td.getDOMElement().style.width = null;
|
4503 |
td.getDOMElement().style.height = null;
|
|
|
4504 |
}
|
4505 |
firstCell = table.rows[i].getElementsByTagName('td')[0];
|
4506 |
if (firstCell) {
|
@@ -4558,6 +4536,7 @@ var array = [],
|
|
4558 |
td.getDOMElement().style.width = null;
|
4559 |
td.getDOMElement().style.height = null;
|
4560 |
}
|
|
|
4561 |
return td;
|
4562 |
};
|
4563 |
|
@@ -4802,9 +4781,13 @@ var array = [],
|
|
4802 |
|
4803 |
for (j = 0; j < cellsColSpan; j++) {
|
4804 |
var td = new WPTB_Cell(mark);
|
4805 |
-
|
4806 |
-
|
4807 |
-
|
|
|
|
|
|
|
|
|
4808 |
r.appendChild(td.getDOMElement());
|
4809 |
}
|
4810 |
|
@@ -5324,6 +5307,25 @@ var array = [],
|
|
5324 |
// }, false );
|
5325 |
// }
|
5326 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5327 |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
5328 |
|
5329 |
var WPTB_TableStateSaveManager = function WPTB_TableStateSaveManager() {
|
@@ -5587,4 +5589,203 @@ var WPTB_TableStateSaveManager = function WPTB_TableStateSaveManager() {
|
|
5587 |
}
|
5588 |
};
|
5589 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5590 |
//# sourceMappingURL=admin.js.map
|
1 |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
var WPTB_ActionsField = function WPTB_ActionsField() {
|
4 |
var _this = this;
|
5 |
|
74 |
|
75 |
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
76 |
wptbTableStateSaveManager.tableStateSet();
|
77 |
+
|
78 |
+
WPTB_Helper.wptbDocumentEventGenerate('element:removed:dom', document, act);
|
79 |
};
|
80 |
|
81 |
btnCopy.onclick = function (event) {
|
1541 |
}, false);
|
1542 |
}
|
1543 |
},
|
1544 |
+
/**
|
1545 |
+
* Sets the control elements when changing which to will restart this control
|
1546 |
+
* @param {array} dependOnControlName
|
1547 |
+
* @param {string} targetControlElementClass
|
1548 |
+
* @param {array} valueDependOnControlCorrect
|
1549 |
+
* @param {string} kind
|
1550 |
+
* @param {HTMLElement} element
|
1551 |
+
*/
|
1552 |
+
valueDependOnControl: function valueDependOnControl(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect, kind, element) {
|
1553 |
+
function dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect) {
|
1554 |
+
if (typeof dependOnControlName === 'string') {
|
1555 |
+
dependOnControlName = [dependOnControlName];
|
1556 |
+
}
|
1557 |
var infArr = targetControlElementClass.match(/wptb-el-((.+-)\d+)-(.+)/i);
|
1558 |
+
var valueDependOnControl = {};
|
1559 |
+
var dependOnControlElementsArr = [];
|
1560 |
if (infArr && Array.isArray(infArr)) {
|
1561 |
var controlName = infArr[3];
|
1562 |
+
var dependOnControlElements = void 0;
|
1563 |
+
var valueDependOnControlCorrectObj = {};
|
1564 |
+
if (Array.isArray(valueDependOnControlCorrect)) {
|
1565 |
+
if (Array.isArray(valueDependOnControlCorrect[0])) {
|
1566 |
+
valueDependOnControlCorrect.map(function (s) {
|
1567 |
+
valueDependOnControlCorrectObj[s[0]] = [s[1], s[2]];
|
1568 |
+
});
|
1569 |
+
} else {
|
1570 |
+
valueDependOnControlCorrectObj[valueDependOnControlCorrect[0]] = [valueDependOnControlCorrect[1], valueDependOnControlCorrect[2]];
|
1571 |
+
}
|
1572 |
+
}
|
1573 |
+
dependOnControlName.map(function (s) {
|
1574 |
+
var dependOnControlElementClass = targetControlElementClass.replace(controlName, s);
|
1575 |
+
if (dependOnControlElementClass) {
|
1576 |
+
dependOnControlElements = document.getElementsByClassName(dependOnControlElementClass);
|
1577 |
+
if (dependOnControlElements.length > 0 && dependOnControlElements[0].type) {
|
1578 |
+
valueDependOnControl[s] = dependOnControlElements[0].value;
|
1579 |
+
if (s in valueDependOnControlCorrectObj) {
|
1580 |
+
if (valueDependOnControlCorrectObj[s][1] === 'integer') {
|
1581 |
+
valueDependOnControl[s] = parseInt(valueDependOnControl[s]) + parseInt(valueDependOnControlCorrectObj[s][0]);
|
1582 |
+
} else if (valueDependOnControlCorrectObj[s][1] === 'string') {
|
1583 |
+
valueDependOnControl[s] = valueDependOnControl[s] + valueDependOnControlCorrectObj[s][0];
|
1584 |
+
}
|
1585 |
+
}
|
1586 |
+
dependOnControlElementsArr.push(dependOnControlElements[0]);
|
1587 |
+
}
|
1588 |
+
}
|
1589 |
+
});
|
1590 |
+
}
|
1591 |
|
1592 |
+
return [valueDependOnControl, dependOnControlElementsArr];
|
1593 |
+
}
|
1594 |
|
1595 |
+
var dependOnControlData = dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect);
|
1596 |
+
WPTB_Helper.elementOptionsSet(kind, element, dependOnControlData[0], targetControlElementClass);
|
1597 |
|
1598 |
+
Object.keys(dependOnControlData[0]).forEach(function (key) {
|
1599 |
+
var infArr = element.className.match(/wptb-element-((.+-)\d+)/i);
|
1600 |
+
var unicClass = 'wptb-el-' + infArr[1] + '-' + [key];
|
1601 |
+
element.addEventListener('wptb-control:' + unicClass, function (event) {
|
1602 |
+
var dependOnControlData = dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect);
|
1603 |
+
WPTB_Helper.elementOptionsSet(kind, element, dependOnControlData[0], targetControlElementClass);
|
1604 |
+
}, false);
|
1605 |
+
});
|
1606 |
+
},
|
1607 |
+
/**
|
1608 |
+
* Sets the visibility of one control to depend on the state of other controls
|
1609 |
+
* @param dependOnMain
|
1610 |
+
* @param targetControlElementClass
|
1611 |
+
*/
|
1612 |
+
appearDependOnControl: function appearDependOnControl(dependOnMain, targetControlElementClass) {
|
1613 |
+
if (Array.isArray(dependOnMain)) {
|
1614 |
+
var dependOnControlElementChangeHandler = function dependOnControlElementChangeHandler(controlContainerElem, dependOnControlElementsValue, k) {
|
1615 |
+
var dependOn = dependOnControlElementsValue[k][2];
|
1616 |
+
var dependOnControlElements = dependOnControlElementsValue[k][1];
|
1617 |
+
dependOnControlElementsValue[dependOn[0]] = [dependOnControlElementValue(dependOnControlElements, dependOn), dependOnControlElements, dependOn];
|
1618 |
+
showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue);
|
1619 |
+
};
|
1620 |
|
1621 |
+
var showHideTargetControlElement = function showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue) {
|
1622 |
+
var display = 'block';
|
1623 |
+
Object.keys(dependOnControlElementsValue).map(function (k) {
|
1624 |
+
if (Object.prototype.hasOwnProperty.call(dependOnControlElementsValue, k)) {
|
1625 |
+
if (dependOnControlElementsValue[k][0] === false) {
|
1626 |
+
display = 'none';
|
1627 |
+
}
|
1628 |
+
}
|
1629 |
+
});
|
1630 |
+
|
1631 |
+
controlContainerElem.style.display = display;
|
1632 |
+
};
|
1633 |
+
|
1634 |
+
var dependOnControlElementValue = function dependOnControlElementValue(dependOnControlElements, dependOn) {
|
1635 |
+
var targetControlValue = WPTB_Helper.targetControlValueGet(dependOnControlElements);
|
1636 |
+
|
1637 |
+
if (dependOn[1] && Array.isArray(dependOn[1]) && dependOn[1].indexOf(targetControlValue) !== -1) {
|
1638 |
+
return true;
|
1639 |
+
// let childCheck = controlContainerElem.querySelector('input[type="checkbox"]')
|
1640 |
+
// if (childCheck) {
|
1641 |
+
// childCheck.checked = true;
|
1642 |
+
// }
|
1643 |
+
} else if (dependOn[2] && Array.isArray(dependOn[2]) && dependOn[2].indexOf(targetControlValue) !== -1) {
|
1644 |
+
return false;
|
1645 |
+
}
|
1646 |
+
};
|
1647 |
+
|
1648 |
+
if (typeof dependOnMain[0] === 'string') {
|
1649 |
+
dependOnMain = [dependOnMain];
|
1650 |
+
} else if (!Array.isArray(dependOnMain[0])) {
|
1651 |
+
return;
|
1652 |
+
}
|
1653 |
+
var dependOnControlElementsValue = {};
|
1654 |
+
for (var i = 0; i < dependOnMain.length; i++) {
|
1655 |
+
var dependOn = dependOnMain[i];
|
1656 |
+
var dependOnControlName = dependOn[0];
|
1657 |
+
var infArr = targetControlElementClass.match(/wptb-el-((.+-)\d+)-(.+)/i);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1658 |
|
1659 |
+
if (infArr && Array.isArray(infArr)) {
|
1660 |
+
var controlName = infArr[3];
|
1661 |
|
1662 |
+
var dependOnControlElementClass = targetControlElementClass.replace(controlName, dependOnControlName);
|
1663 |
+
if (dependOnControlElementClass) {
|
1664 |
+
var dependOnControlElements = document.getElementsByClassName(dependOnControlElementClass);
|
1665 |
+
if (dependOnControlElements.length > 0) {
|
1666 |
+
dependOnControlElementsValue[dependOn[0]] = [dependOnControlElementValue(dependOnControlElements, dependOn), dependOnControlElements, dependOn];
|
1667 |
}
|
1668 |
}
|
1669 |
}
|
1670 |
}
|
1671 |
+
|
1672 |
+
var targetControlElement = document.getElementsByClassName(targetControlElementClass);
|
1673 |
+
if (targetControlElement.length > 0) {
|
1674 |
+
targetControlElement = targetControlElement[0];
|
1675 |
+
var controlContainerElem = WPTB_Helper.findAncestor(targetControlElement, 'wptb-element-option');
|
1676 |
+
|
1677 |
+
if (controlContainerElem) {
|
1678 |
+
showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue);
|
1679 |
+
|
1680 |
+
Object.keys(dependOnControlElementsValue).map(function (k) {
|
1681 |
+
if (Object.prototype.hasOwnProperty.call(dependOnControlElementsValue, k)) {
|
1682 |
+
var _dependOnControlElements = dependOnControlElementsValue[k][1];
|
1683 |
+
var dependOnControlElement = _dependOnControlElements[0];
|
1684 |
+
dependOnControlElement.addEventListener('change', dependOnControlElementChangeHandler.bind(null, controlContainerElem, dependOnControlElementsValue, k), false);
|
1685 |
+
}
|
1686 |
+
});
|
1687 |
+
}
|
1688 |
+
}
|
1689 |
}
|
1690 |
},
|
1691 |
//
|
1872 |
}
|
1873 |
},
|
1874 |
//
|
1875 |
+
elementOptionsSet: function elementOptionsSet(kind, element, valueDependOnControl, targetControlElementClass) {
|
1876 |
// get controls config for this element
|
1877 |
var wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';
|
1878 |
var tmplControlsConfig = wp.template(wptbContrlStacksConfigId);
|
1905 |
data = {
|
1906 |
container: '.' + infArr[0]
|
1907 |
};
|
1908 |
+
var controlName = void 0;
|
1909 |
+
data.valueDependOnControl = {};
|
1910 |
+
if (valueDependOnControl) {
|
1911 |
+
Object.keys(valueDependOnControl).forEach(function (key) {
|
1912 |
+
data.valueDependOnControl[key] = valueDependOnControl[key];
|
1913 |
+
});
|
1914 |
+
}
|
1915 |
+
if (targetControlElementClass) {
|
1916 |
+
var _infArr = targetControlElementClass.match(/wptb-el-((.+-)\d+)-(.+)/i);
|
1917 |
+
|
1918 |
+
if (_infArr && Array.isArray(_infArr)) {
|
1919 |
+
controlName = _infArr[3];
|
1920 |
+
}
|
1921 |
+
}
|
1922 |
|
1923 |
elementContainerClass = infArr[0];
|
1924 |
elementOptionClassIndic = infArr[1];
|
1933 |
for (var _i4 = 0; _i4 < children.length; _i4++) {
|
1934 |
if (children[_i4].style) children[_i4].style.display = 'none';
|
1935 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1936 |
this.activateSection('options_group');
|
1937 |
}
|
1938 |
|
1939 |
+
var controlsConfigJson = tmplControlsConfig(data);
|
1940 |
+
var controlsConfig = JSON.parse(controlsConfigJson);
|
1941 |
|
1942 |
var elementOptionsGroupIdsInvolved = [],
|
1943 |
elementOptionsGroupInvolved = {},
|
1946 |
// object for save all scrips for each controls
|
1947 |
var controlScriptsObj = {};
|
1948 |
|
1949 |
+
// array for keep "appear depend on" params
|
1950 |
var controlappearDependOnControl = [];
|
1951 |
|
1952 |
+
// array for keep "value depend on" params
|
1953 |
+
var controlValueDependOnControl = [];
|
1954 |
+
|
1955 |
// create controls
|
1956 |
var elementOptionsScriptsContainerIndic = false;
|
1957 |
+
if (controlName) {
|
1958 |
+
var controlsConfigNew = {};
|
1959 |
+
controlsConfigNew[controlName] = controlsConfig[controlName];
|
1960 |
+
controlsConfig = controlsConfigNew;
|
1961 |
+
}
|
1962 |
var i = 0;
|
1963 |
+
Object.keys(controlsConfig).forEach(function (key) {
|
1964 |
+
var data = controlsConfig[key];
|
1965 |
data.controlKey = key;
|
1966 |
|
1967 |
// get necessary wp js template
|
1969 |
|
1970 |
data.elemContainer = elementContainerClass;
|
1971 |
data.elementControlTargetUnicClass = 'wptb-el-' + elementOptionClassIndic + '-' + data.controlKey;
|
1972 |
+
Object.keys(data).map(function (k) {
|
1973 |
+
if (Object.prototype.hasOwnProperty.call(data, k) && data[k] === 'control_param_calculate_value') {
|
1974 |
+
data[k] = WPTB_Helper.controlParamCalculateValue(data.elementControlTargetUnicClass, k);
|
1975 |
+
}
|
1976 |
+
});
|
1977 |
var controlTemplate = tmplControlTemplate(data);
|
1978 |
if ('appearDependOnControl' in data) {
|
1979 |
if (Array.isArray(data.appearDependOnControl)) {
|
1981 |
}
|
1982 |
}
|
1983 |
|
1984 |
+
if ('valueDependOnControl' in data && !valueDependOnControl && !targetControlElementClass) {
|
1985 |
+
var valueDependOnControlCorrect = '';
|
1986 |
+
if (data.valueDependOnControlCorrect) valueDependOnControlCorrect = data.valueDependOnControlCorrect;
|
1987 |
+
controlValueDependOnControl.push([data.valueDependOnControl, data.elementControlTargetUnicClass, valueDependOnControlCorrect]);
|
1988 |
+
}
|
1989 |
+
|
1990 |
function elementOptionsContainerInvolvedGet(elementOptionsGroupId, elementOptionsContainerInvolved) {
|
1991 |
if (!elementOptionsContainerInvolved[elementOptionsGroupId]) {
|
1992 |
var elementOptionsContainer = document.createElement('div');
|
1998 |
return elementOptionsContainerInvolved[elementOptionsGroupId];
|
1999 |
}
|
2000 |
|
2001 |
+
if (elementOptionsGroupIdsInvolved.indexOf(data.elementOptionsGroupId) == -1 && !controlName) {
|
2002 |
elementOptionsGroupIdsInvolved.push(data.elementOptionsGroupId);
|
2003 |
// clear elements from options group
|
2004 |
//document.getElementById( 'element-options-group' ).innerHTML = '';
|
2012 |
|
2013 |
controlElementParent = elementOptionsGroupInvolved[data.elementOptionsGroupId];
|
2014 |
|
2015 |
+
if (data.elementOptionsContainerOn === 'true' && !controlName) {
|
2016 |
controlElementParent = elementOptionsContainerInvolvedGet(data.elementOptionsGroupId, elementOptionsContainerInvolved);
|
2017 |
}
|
2018 |
|
2028 |
elementOptionContainer.setAttribute('style', data.containerAdditionalStyles);
|
2029 |
}
|
2030 |
|
2031 |
+
if (targetControlElementClass) {
|
2032 |
+
var targetControlElement = document.getElementsByClassName(targetControlElementClass);
|
2033 |
+
if (targetControlElement.length > 0) {
|
2034 |
+
targetControlElement = targetControlElement[0];
|
2035 |
+
var controlContainerElem = WPTB_Helper.findAncestor(targetControlElement, 'wptb-element-option');
|
2036 |
|
2037 |
+
if (controlContainerElem) {
|
2038 |
+
var controlContainerElemParent = controlContainerElem.parentNode;
|
2039 |
+
controlContainerElemParent.insertBefore(elementOptionContainer, controlContainerElem);
|
2040 |
+
controlContainerElemParent.removeChild(controlContainerElem);
|
2041 |
+
}
|
2042 |
+
}
|
2043 |
+
} else {
|
2044 |
+
controlElementParent.appendChild(elementOptionContainer);
|
2045 |
+
}
|
2046 |
controlElementParent = elementOptionContainer;
|
2047 |
}
|
2048 |
controlElementParent.innerHTML = controlElementParent.innerHTML + controlTemplate;
|
2054 |
controlElementParent.removeChild(helperJavascriptElem);
|
2055 |
var script = document.createElement('script');
|
2056 |
script.setAttribute('type', 'text/javascript');
|
2057 |
+
script.setAttribute('id', kind + '-' + data.controlKey);
|
2058 |
script.innerHTML = helperJavascriptCode.replace(/\r|\n|\t/g, '').trim();
|
2059 |
if (!controlScriptsObj[data.elementOptionsGroupId] || !Array.isArray(controlScriptsObj[data.elementOptionsGroupId])) {
|
2060 |
controlScriptsObj[data.elementOptionsGroupId] = [];
|
2068 |
element.optionsGroupIds = elementOptionsGroupIdsInvolved;
|
2069 |
|
2070 |
Object.keys(controlScriptsObj).forEach(function (elementOptionsGroupId) {
|
2071 |
+
if (!targetControlElementClass) {
|
2072 |
+
elementOptionsScriptsContainer = document.createElement('div');
|
2073 |
+
elementOptionsScriptsContainer.classList.add('wptb-element-options-scripts', 'wptb-options-' + infArr[1]);
|
2074 |
+
elementOptionsGroupInvolved[elementOptionsGroupId].appendChild(elementOptionsScriptsContainer);
|
2075 |
+
}
|
2076 |
+
|
2077 |
var controlScriptsArr = controlScriptsObj[elementOptionsGroupId];
|
|
|
|
|
|
|
2078 |
if (controlScriptsArr.length > 0) {
|
2079 |
for (var _i6 = 0; _i6 < controlScriptsArr.length; _i6++) {
|
2080 |
+
if (targetControlElementClass) {
|
2081 |
+
var id = kind + '-' + controlName;
|
2082 |
+
var script = document.getElementById(id);
|
2083 |
+
elementOptionsScriptsContainer = script.parentNode;
|
2084 |
+
elementOptionsScriptsContainer.insertBefore(controlScriptsArr[_i6], script);
|
2085 |
+
elementOptionsScriptsContainer.removeChild(script);
|
2086 |
+
} else {
|
2087 |
+
elementOptionsScriptsContainer.appendChild(controlScriptsArr[_i6]);
|
2088 |
+
}
|
2089 |
}
|
2090 |
}
|
2091 |
});
|
2092 |
|
2093 |
// run the scripts of controls
|
2094 |
|
|
|
2095 |
// run appearDependOnControl function
|
2096 |
for (var _i7 = 0; _i7 < controlappearDependOnControl.length; _i7++) {
|
2097 |
WPTB_Helper.appearDependOnControl(controlappearDependOnControl[_i7][0], controlappearDependOnControl[_i7][1]);
|
2098 |
}
|
2099 |
|
2100 |
WPTB_Helper.wptbDocumentEventGenerate('element:controls:active', element);
|
2101 |
+
// run valueDependOnControl function
|
2102 |
+
for (var _i8 = 0; _i8 < controlValueDependOnControl.length; _i8++) {
|
2103 |
+
WPTB_Helper.valueDependOnControl(controlValueDependOnControl[_i8][0], controlValueDependOnControl[_i8][1], controlValueDependOnControl[_i8][2], kind, element);
|
2104 |
+
}
|
2105 |
+
},
|
2106 |
+
|
2107 |
+
/**
|
2108 |
+
*
|
2109 |
+
* @param unicClass
|
2110 |
+
* @param controlKey
|
2111 |
+
* @param key
|
2112 |
+
* @returns {*}
|
2113 |
+
*/
|
2114 |
+
controlParamCalculateValue: function controlParamCalculateValue(unicClass, key) {
|
2115 |
+
var unicClassP = WPTB_Helper.replaceAll(unicClass, '-', '_');
|
2116 |
+
if (window['paramCalculateValue_' + unicClassP + '_' + key] && typeof window['paramCalculateValue_' + unicClassP + '_' + key] === "function") {
|
2117 |
+
return window['paramCalculateValue_' + unicClassP + '_' + key]();
|
2118 |
+
}
|
2119 |
+
},
|
2120 |
+
|
2121 |
+
controlParamCalculateValueCreateFunction: function controlParamCalculateValueCreateFunction(element, controlKey, key, handlerFunction) {
|
2122 |
+
var infArr = element.className.match(/wptb-element-((.+-)\d+)/i);
|
2123 |
+
var unicClass = 'wptb-el-' + infArr[1] + '-' + controlKey;
|
2124 |
+
var unicClassP = WPTB_Helper.replaceAll(unicClass, '-', '_');
|
2125 |
+
window['paramCalculateValue_' + unicClassP + '_' + key] = function () {
|
2126 |
+
return handlerFunction(element);
|
2127 |
+
};
|
2128 |
},
|
2129 |
|
2130 |
/**
|
2143 |
if (table.length > 0) {
|
2144 |
table = table[0];
|
2145 |
|
2146 |
+
var _infArr2 = table.className.match(/wptb-element-main(.+)-(\d+)/i);
|
2147 |
+
if (_infArr2 && Array.isArray(_infArr2)) {
|
2148 |
+
selector = '.' + _infArr2[0] + ' ' + selector;
|
2149 |
}
|
2150 |
}
|
2151 |
}
|
2696 |
wptbPreviewTable.parentNode.classList.remove('wptb-preview-table-manage-cells');
|
2697 |
var wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName('td');
|
2698 |
if (wptbPreviewTableTds.length > 0) {
|
2699 |
+
for (var _i9 = 0; _i9 < wptbPreviewTableTds.length; _i9++) {
|
2700 |
+
wptbPreviewTableTds[_i9].classList.remove('wptb-highlighted');
|
2701 |
}
|
2702 |
}
|
2703 |
toggleEditMode = 'closed';
|
2837 |
getValueMaxCountSameElementsInArray: function getValueMaxCountSameElementsInArray(arr) {
|
2838 |
if (arr && Array.isArray(arr)) {
|
2839 |
var check = {};
|
2840 |
+
var countEmpty = 0;
|
2841 |
for (var i = 0; i < arr.length; i++) {
|
2842 |
+
if (arr[i]) {
|
2843 |
+
if (check[arr[i]]) {
|
2844 |
+
check[arr[i]]++;
|
2845 |
+
} else {
|
2846 |
+
check[arr[i]] = 1;
|
2847 |
+
}
|
2848 |
} else {
|
2849 |
+
countEmpty++;
|
2850 |
}
|
2851 |
}
|
2852 |
|
2862 |
}
|
2863 |
}
|
2864 |
|
2865 |
+
return check[maxPropName] >= countEmpty ? maxPropName : '';
|
2866 |
}
|
2867 |
},
|
2868 |
|
2920 |
}
|
2921 |
}
|
2922 |
jMainIter++;
|
2923 |
+
}
|
2924 |
|
2925 |
+
if (tds.length > maxCols) {
|
2926 |
+
maxCols = tds.length;
|
|
|
2927 |
}
|
2928 |
|
2929 |
if (i == 0) {
|
2993 |
// get drag relative type
|
2994 |
getDragRelativeType: function getDragRelativeType() {
|
2995 |
return this.dragRelativeType;
|
2996 |
+
},
|
2997 |
+
/**
|
2998 |
+
*
|
2999 |
+
* @param {HTMLElement} element
|
3000 |
+
* @param {string} styleName
|
3001 |
+
*/
|
3002 |
+
getElementColorStylesHex: function getElementColorStylesHex(element, styleName) {
|
3003 |
+
var color = element.style[styleName];
|
3004 |
+
color = WPTB_Helper.rgbToHex(color);
|
3005 |
+
if (!WPTB_Helper.isHex(color)) {
|
3006 |
+
color = '';
|
3007 |
+
}
|
3008 |
+
return color;
|
3009 |
+
},
|
3010 |
+
/**
|
3011 |
+
* Show element controls on adding them to table.
|
3012 |
+
*/
|
3013 |
+
showControlsOnElementMount: function showControlsOnElementMount() {
|
3014 |
+
document.addEventListener('element:mounted:dom', function (e) {
|
3015 |
+
e.target.click();
|
3016 |
+
});
|
3017 |
+
},
|
3018 |
+
|
3019 |
+
/**
|
3020 |
+
* Show elements list menu on left panel on removing element from table
|
3021 |
+
*/
|
3022 |
+
showElementsListOnRemove: function showElementsListOnRemove() {
|
3023 |
+
document.addEventListener('element:removed:dom', function () {
|
3024 |
+
WPTB_Helper.activateSection('elements');
|
3025 |
+
});
|
3026 |
}
|
3027 |
};
|
3028 |
var WPTB_Initializer = function WPTB_Initializer() {
|
3029 |
|
3030 |
+
var MIN_COLUMNS = 1,
|
3031 |
+
MIN_ROWS = 1,
|
3032 |
+
MAX_COLUMNS = 30,
|
3033 |
+
MAX_ROWS = 30;
|
3034 |
|
3035 |
+
var tableGenerator = document.body;
|
3036 |
+
columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0], columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0], rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1], rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1], columnsInput = document.getElementById('wptb-columns-number'), rowsInput = document.getElementById('wptb-rows-number');
|
3037 |
|
3038 |
+
columnsDecrementButton.onclick = function () {
|
3039 |
+
if (columnsInput.value > MIN_COLUMNS) {
|
3040 |
+
columnsInput.value--;
|
3041 |
+
}
|
3042 |
+
};
|
3043 |
|
3044 |
+
columnsIncrementButton.onclick = function () {
|
3045 |
+
if (columnsInput.value < MAX_COLUMNS) {
|
3046 |
+
columnsInput.value++;
|
3047 |
+
}
|
3048 |
+
};
|
3049 |
|
3050 |
+
rowsDecrementButton.onclick = function () {
|
3051 |
+
if (rowsInput.value > MIN_ROWS) {
|
3052 |
+
rowsInput.value--;
|
3053 |
+
}
|
3054 |
+
};
|
3055 |
|
3056 |
+
rowsIncrementButton.onclick = function () {
|
3057 |
+
if (rowsInput.value < MAX_ROWS) {
|
3058 |
+
rowsInput.value++;
|
3059 |
+
}
|
3060 |
+
};
|
3061 |
|
3062 |
+
document.getElementById('wptb-generate-table').onclick = function () {
|
3063 |
+
var columns = document.getElementById('wptb-columns-number').value,
|
3064 |
+
rows = document.getElementById('wptb-rows-number').value;
|
3065 |
|
3066 |
+
//wptbTableStateSaveManager.tableStateClear();
|
3067 |
|
3068 |
+
WPTB_Table(columns, rows);
|
3069 |
|
3070 |
+
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
3071 |
+
wptbTableStateSaveManager.tableStateSet();
|
3072 |
+
};
|
3073 |
+
|
3074 |
+
// register and setup section buttons
|
3075 |
+
WPTB_Helper.registerSections(['elements', 'table_settings', 'cell_settings', 'options_group', 'table_responsive_menu']);
|
3076 |
+
WPTB_Helper.setupSectionButtons();
|
3077 |
|
3078 |
+
// activate elements section for startup
|
3079 |
+
WPTB_Helper.activateSection('elements');
|
|
|
3080 |
|
3081 |
+
// side bar toggle setup
|
3082 |
+
// WPTB_Helper.setupSidebarToggle('.wptb-panel-drawer-toggle');
|
3083 |
+
WPTB_Helper.setupSidebarToggle('.wptb-panel-toggle-section .wptb-panel-drawer-icon');
|
3084 |
|
3085 |
+
// setup panel sections that have the ability to be toggled on/off
|
3086 |
+
WPTB_Helper.setupPanelToggleButtons();
|
|
|
3087 |
|
3088 |
+
// setup responsive menu both at left and builder panel
|
3089 |
+
new WptbResponsive('table_responsive_menu', 'wptbResponsiveApp', '.wptb-builder-content');
|
3090 |
|
3091 |
+
// get builder section from url parameter for easy switch at page load
|
3092 |
+
WPTB_Helper.getSectionFromUrl();
|
3093 |
|
3094 |
+
// automatically show element controls when dropped to table
|
3095 |
+
WPTB_Helper.showControlsOnElementMount();
|
3096 |
+
|
3097 |
+
// show elements list menu on left panel on removing elements from table
|
3098 |
+
WPTB_Helper.showElementsListOnRemove();
|
3099 |
};
|
3100 |
+
var WPTB_LeftPanel = function WPTB_LeftPanel() {
|
3101 |
|
3102 |
+
var table = document.getElementsByClassName('wptb-preview-table')[0],
|
3103 |
+
wptbElementButtons = document.getElementsByClassName('wptb-element');
|
|
|
|
|
|
|
|
|
3104 |
|
3105 |
+
for (var i = 0; i < wptbElementButtons.length; i++) {
|
3106 |
+
wptbElementButtons[i].ondragstart = function (e) {
|
3107 |
+
e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);
|
3108 |
+
e.dataTransfer.setData('wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement);
|
3109 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3110 |
};
|
3111 |
|
3112 |
if (table) {
|
3114 |
for (var _i = 0; _i < wptbTablesEditModeCloseButton.length; _i++) {
|
3115 |
wptbTablesEditModeCloseButton[_i].onclick = WPTB_Helper.toggleTableEditMode;
|
3116 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3117 |
};
|
3118 |
|
3119 |
// this code hides the "element parameters" area
|
4434 |
td.getDOMElement().setAttribute('style', currentTdStyle);
|
4435 |
td.getDOMElement().style.width = null;
|
4436 |
td.getDOMElement().style.height = null;
|
4437 |
+
td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');
|
4438 |
}
|
4439 |
|
4440 |
table.rows[i].appendChild(td.getDOMElement());
|
4478 |
td.getDOMElement().setAttribute('style', currentTdStyle);
|
4479 |
td.getDOMElement().style.width = null;
|
4480 |
td.getDOMElement().style.height = null;
|
4481 |
+
td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');
|
4482 |
}
|
4483 |
firstCell = table.rows[i].getElementsByTagName('td')[0];
|
4484 |
if (firstCell) {
|
4536 |
td.getDOMElement().style.width = null;
|
4537 |
td.getDOMElement().style.height = null;
|
4538 |
}
|
4539 |
+
td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');
|
4540 |
return td;
|
4541 |
};
|
4542 |
|
4781 |
|
4782 |
for (j = 0; j < cellsColSpan; j++) {
|
4783 |
var td = new WPTB_Cell(mark);
|
4784 |
+
var currentTableTd = table.querySelector('[data-x-index="' + j + '"]');
|
4785 |
+
if (currentTableTd) {
|
4786 |
+
var currentTdStyle = currentTableTd.getAttribute('style');
|
4787 |
+
|
4788 |
+
td.getDOMElement().setAttribute('style', currentTdStyle);
|
4789 |
+
td.getDOMElement().style.height = null;
|
4790 |
+
}
|
4791 |
r.appendChild(td.getDOMElement());
|
4792 |
}
|
4793 |
|
5307 |
// }, false );
|
5308 |
// }
|
5309 |
};
|
5310 |
+
var WPTB_TableSettingsData = {
|
5311 |
+
borderColor: '',
|
5312 |
+
/**
|
5313 |
+
*
|
5314 |
+
* @param {string} name
|
5315 |
+
* @param {string} value
|
5316 |
+
*/
|
5317 |
+
setTableSetting: function setTableSetting(name, value) {
|
5318 |
+
this[name] = value;
|
5319 |
+
},
|
5320 |
+
/**
|
5321 |
+
*
|
5322 |
+
* @param {string} name
|
5323 |
+
* @returns {*}
|
5324 |
+
*/
|
5325 |
+
getTableSetting: function getTableSetting(name) {
|
5326 |
+
return this[name];
|
5327 |
+
}
|
5328 |
+
};
|
5329 |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
5330 |
|
5331 |
var WPTB_TableStateSaveManager = function WPTB_TableStateSaveManager() {
|
5589 |
}
|
5590 |
};
|
5591 |
};
|
5592 |
+
var WPTB_innerElementSet = function WPTB_innerElementSet(element) {
|
5593 |
+
|
5594 |
+
element.ondragenter = function (e) {
|
5595 |
+
var div;
|
5596 |
+
if (e.dataTransfer.types.indexOf('wptbelement') == -1 && e.dataTransfer.types.indexOf('wptb-moving-mode') == -1) {
|
5597 |
+
return;
|
5598 |
+
}
|
5599 |
+
WPTB_DropHandle(this, e);
|
5600 |
+
|
5601 |
+
element.classList.add('wptb-ondragenter');
|
5602 |
+
};
|
5603 |
+
element.ondragover = function (e) {
|
5604 |
+
e.preventDefault();
|
5605 |
+
WPTB_DropHandle(this, e);
|
5606 |
+
};
|
5607 |
+
element.ondragleave = function (e) {
|
5608 |
+
WPTB_DropHandle(this, e, true);
|
5609 |
+
};
|
5610 |
+
element.ondrop = function (e) {
|
5611 |
+
this.classList.remove('wptb-ondragenter');
|
5612 |
+
var element = void 0,
|
5613 |
+
classId = void 0;
|
5614 |
+
e.preventDefault();
|
5615 |
+
e.stopPropagation();
|
5616 |
+
|
5617 |
+
if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {
|
5618 |
+
return;
|
5619 |
+
}
|
5620 |
+
var wptbDropHandle = void 0,
|
5621 |
+
wptbDropBorderMarker = void 0;
|
5622 |
+
if (document.getElementsByClassName('wptb-drop-handle').length > 0) {
|
5623 |
+
wptbDropHandle = document.getElementsByClassName('wptb-drop-handle')[0];
|
5624 |
+
}
|
5625 |
+
if (document.getElementsByClassName('wptb-drop-border-marker').length > 0) {
|
5626 |
+
wptbDropBorderMarker = document.getElementsByClassName('wptb-drop-border-marker')[0];
|
5627 |
+
}
|
5628 |
+
|
5629 |
+
if (e.dataTransfer.getData('wptbElement')) {
|
5630 |
+
element = WPTB_Helper.newElementProxy(e.dataTransfer.getData('wptbElement'));
|
5631 |
+
element = element.getDOMElement();
|
5632 |
+
} else {
|
5633 |
+
classId = e.dataTransfer.getData('node');
|
5634 |
+
element = document.getElementsByClassName(classId)[0];
|
5635 |
+
//element.classList.remove( 'wptb-moving-mode' );
|
5636 |
+
}
|
5637 |
+
|
5638 |
+
if (WPTB_Helper.getDragRelativeType() === 'td_relative') {
|
5639 |
+
WPTB_DropHandle(this, e, true);
|
5640 |
+
var parentCell = WPTB_Helper.getParentOfType('td', e.target);
|
5641 |
+
|
5642 |
+
parentCell.appendChild(element);
|
5643 |
+
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
5644 |
+
} else if (wptbDropHandle.style.display == 'block') {
|
5645 |
+
var td = void 0;
|
5646 |
+
if (wptbDropHandle.dataset.text == 'Drop Here') {
|
5647 |
+
td = wptbDropHandle.getDOMParentElement();
|
5648 |
+
td.appendChild(element);
|
5649 |
+
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
5650 |
+
} else {
|
5651 |
+
var innerElement = wptbDropHandle.getDOMParentElement();
|
5652 |
+
td = innerElement.parentNode;
|
5653 |
+
|
5654 |
+
if (wptbDropHandle.dataset.text == 'Above Element') {
|
5655 |
+
td.insertBefore(element, innerElement);
|
5656 |
+
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
5657 |
+
} else if (wptbDropHandle.dataset.text == 'Below Element') {
|
5658 |
+
var innerElementNext = innerElement.nextSibling;
|
5659 |
+
td.insertBefore(element, innerElementNext);
|
5660 |
+
WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);
|
5661 |
+
}
|
5662 |
+
}
|
5663 |
+
|
5664 |
+
var thisRow = td.parentNode;
|
5665 |
+
if (WPTB_Helper.rowIsTop(thisRow)) {
|
5666 |
+
var table = WPTB_Helper.findAncestor(thisRow, 'wptb-preview-table');
|
5667 |
+
|
5668 |
+
if (table.classList.contains('wptb-table-preview-head')) {
|
5669 |
+
WPTB_Helper.dataTitleColumnSet(table);
|
5670 |
+
}
|
5671 |
+
}
|
5672 |
+
|
5673 |
+
// start item javascript if item is new
|
5674 |
+
var infArr = element.className.match(/wptb-element-(.+)-(\d+)/i);
|
5675 |
+
var elemKind = infArr[1];
|
5676 |
+
if (e.dataTransfer.getData('wptbElement') && (elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list')) {
|
5677 |
+
//WPTB_Helper.elementStartScript( element );
|
5678 |
+
}
|
5679 |
+
} else {
|
5680 |
+
return;
|
5681 |
+
}
|
5682 |
+
|
5683 |
+
if (wptbDropHandle) {
|
5684 |
+
wptbDropHandle.style.display = 'none';
|
5685 |
+
wptbDropBorderMarker.style.display = 'none';
|
5686 |
+
}
|
5687 |
+
|
5688 |
+
WPTB_innerElementSet(element);
|
5689 |
+
|
5690 |
+
if (!element.classList.contains('wptb-image-container') || element.classList.contains('wptb-moving-mode')) {
|
5691 |
+
element.classList.remove('wptb-moving-mode');
|
5692 |
+
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
5693 |
+
wptbTableStateSaveManager.tableStateSet();
|
5694 |
+
}
|
5695 |
+
return true;
|
5696 |
+
};
|
5697 |
+
element.onmouseover = function (e) {
|
5698 |
+
element.classList.remove('wptb-ondragenter');
|
5699 |
+
};
|
5700 |
+
};
|
5701 |
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
5702 |
+
|
5703 |
+
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); } }
|
5704 |
+
|
5705 |
+
var applyGenericItemSettings = function applyGenericItemSettings(element, kindIndexProt) {
|
5706 |
+
var copy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
5707 |
+
|
5708 |
+
var node = element.getDOMElement(),
|
5709 |
+
index,
|
5710 |
+
copy;
|
5711 |
+
if (node.classList.contains('wptb-ph-element')) {
|
5712 |
+
if (kindIndexProt == undefined || copy == true) {
|
5713 |
+
//index = document.counter.nextIndex( element.kind );
|
5714 |
+
var wptbElements = document.getElementsByClassName('wptb-ph-element');
|
5715 |
+
var elementIndexesArr = [];
|
5716 |
+
for (var i = 0; i < wptbElements.length; i++) {
|
5717 |
+
var regex = new RegExp('wptb-element-' + element.kind + '-(\\d+)', "i");
|
5718 |
+
var infArr = wptbElements[i].className.match(regex);
|
5719 |
+
if (infArr) {
|
5720 |
+
elementIndexesArr.push(infArr[1]);
|
5721 |
+
}
|
5722 |
+
}
|
5723 |
+
if (elementIndexesArr.length > 0) {
|
5724 |
+
var elementIndexMax = Math.max.apply(Math, elementIndexesArr);
|
5725 |
+
index = elementIndexMax + 1;
|
5726 |
+
} else {
|
5727 |
+
index = 1;
|
5728 |
+
}
|
5729 |
+
|
5730 |
+
if (copy) {
|
5731 |
+
// change all data-elements which save parameters for different controls
|
5732 |
+
var wptbNodeattributes = [].concat(_toConsumableArray(node.attributes));
|
5733 |
+
for (var _i = 0; _i < wptbNodeattributes.length; _i++) {
|
5734 |
+
if (wptbNodeattributes[_i] && _typeof(wptbNodeattributes[_i]) === 'object' && wptbNodeattributes[_i].nodeName) {
|
5735 |
+
var regularText = new RegExp('data-wptb-el-' + element.kind + '-(\\d+)-([a-zA-Z0-9_-]+)', "i");
|
5736 |
+
var attr = wptbNodeattributes[_i].nodeName.match(regularText);
|
5737 |
+
if (attr && Array.isArray(attr)) {
|
5738 |
+
var newDataAttributeName = wptbNodeattributes[_i].nodeName.replace(element.kind + '-' + attr[1], element.kind + '-' + index);
|
5739 |
+
var newDataAttributeValue = wptbNodeattributes[_i].nodeValue;
|
5740 |
+
node.removeAttribute(wptbNodeattributes[_i].nodeName);
|
5741 |
+
node.setAttribute(newDataAttributeName, newDataAttributeValue);
|
5742 |
+
}
|
5743 |
+
}
|
5744 |
+
}
|
5745 |
+
}
|
5746 |
+
} else if (kindIndexProt && !copy) {
|
5747 |
+
var kindIndexProtArr = kindIndexProt.split('-');
|
5748 |
+
index = kindIndexProtArr[kindIndexProtArr.length - 1];
|
5749 |
+
// start element javascript if element is new
|
5750 |
+
}
|
5751 |
+
|
5752 |
+
var node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\d+)/i);
|
5753 |
+
if (node_wptb_element_kind_num) {
|
5754 |
+
node.classList.remove(node_wptb_element_kind_num[0]);
|
5755 |
+
}
|
5756 |
+
if (!node.classList.contains('wptb-ph-element')) {
|
5757 |
+
node.classList.add('wptb-ph-element');
|
5758 |
+
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
5759 |
+
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
5760 |
+
}
|
5761 |
+
} else {
|
5762 |
+
if (!node.classList.contains('wptb-element-' + element.kind + '-' + index)) {
|
5763 |
+
node.classList.add('wptb-element-' + element.kind + '-' + index);
|
5764 |
+
}
|
5765 |
+
}
|
5766 |
+
WPTB_Helper.elementStartScript(element.getDOMElement());
|
5767 |
+
new WPTB_ElementOptions(element, index, kindIndexProt);
|
5768 |
+
document.counter.increment(element.kind);
|
5769 |
+
}
|
5770 |
+
|
5771 |
+
node.onmouseenter = function (event) {
|
5772 |
+
if (event.target.classList.contains('wptb-moving-mode')) {
|
5773 |
+
return;
|
5774 |
+
}
|
5775 |
+
|
5776 |
+
var wptbActionsField = new WPTB_ActionsField();
|
5777 |
+
|
5778 |
+
wptbActionsField.addActionField(1, node);
|
5779 |
+
|
5780 |
+
wptbActionsField.setParameters(node);
|
5781 |
+
|
5782 |
+
node.classList.remove('wptb-ondragenter');
|
5783 |
+
};
|
5784 |
+
|
5785 |
+
node.onmouseleave = function (event) {
|
5786 |
+
var wptbActionsField = new WPTB_ActionsField();
|
5787 |
+
|
5788 |
+
wptbActionsField.leaveFromField(event, node);
|
5789 |
+
};
|
5790 |
+
};
|
5791 |
//# sourceMappingURL=admin.js.map
|
inc/admin/js/admin.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["applyGenericItemSettings.js","WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementObject.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Initializer.js","WPTB_innerElementSet.js","WPTB_LeftPanel.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Polyfills.js","WPTB_Responsive.js","WPTB_Settings.js","WPTB_Stringifier.js","WPTB_Table.js","WPTB_TableStateSaveManager.js"],"names":["applyGenericItemSettings","element","kindIndexProt","copy","node","getDOMElement","index","classList","contains","undefined","wptbElements","document","getElementsByClassName","elementIndexesArr","i","length","regex","RegExp","kind","infArr","className","match","push","elementIndexMax","Math","max","wptbNodeattributes","attributes","nodeName","regularText","attr","Array","isArray","newDataAttributeName","replace","newDataAttributeValue","nodeValue","removeAttribute","setAttribute","kindIndexProtArr","split","node_wptb_element_kind_num","remove","add","WPTB_Helper","elementStartScript","WPTB_ElementOptions","counter","increment","onmouseenter","event","target","wptbActionsField","WPTB_ActionsField","addActionField","setParameters","onmouseleave","leaveFromField","wptbActions","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","parentNode","removeChild","btnDelete","btnCopy","createElement","appendChild","type","onclick","act","el","hasOwnProperty","thisRow","rowIsTop","table","findAncestor","dataTitleColumnSet","actionsRemove","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","activeElement","activeElemParent","data","elemProt","tinyMceClear","WPTB_ElementObject","insertBefore","nextSibling","elementCopy","cloneNode","wptbDocumentEventGenerate","WPTB_innerElementSet","btnMove","draggable","ondragstart","wptbElementIconsDirectories","tmplIconsDirectories","wp","template","jsonIconsDirectories","IconsDirectories","JSON","parse","dragImages","getElementIcon","dataTransfer","effectAllowed","setDragImage","setData","style","display","actionsHide","ondragend","elementDragEndClear","coordinatesElement","getBoundingClientRect","wptbContainer","correctTop","top","parseFloat","removeEventListener","left","right","clientWidth","addEventListener","relatedTarget","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","responseText","getElementById","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","querySelector","dataset","wptbTableContainerMaxWidth","maxWidth","tdDefaultWidth","WPTB_Settings","send","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","url","window","location","href","results","exec","WPTB_Cell","callback","DOMElement","highlightRow","td","parentRow","columnCount","parseInt","tds","classToAdd","ttd","highlightColumn","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","ondblclick","stopPropagation","currentTarget","newElementProxy","wptbPhElement","wptbElementTypeClass","wptbTypeElementArr","wptbInternalActiveElement","j","wptbInternalActiveElementObj","setCoords","y","x","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","offsetWidth","height","offsetHeight","borderCollapse","tableFullStyleObj","tableBorderLeft","tableBorderRight","tableBorderTop","tableBorderBottom","toLowerCase","firstChild","lastChild","WPTB_DropHandle","thisElem","e","hide","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","toPx","getDragRelativeType","cellRelatedDropHandle","range","createRange","setStart","shadowRoot","createContextualFragment","children","parentTd","getParentOfType","ondragenter","preventDefault","ondragover","ondragleave","ondrop","getData","wptbMovingMode","text","getDOMParentElement","innerElement","innerElementNext","onscroll","localName","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","key","nextIndex","wpTemplateId","itemHtml","trim","innerHTML","wptbElementMutch","elementClearFromTinyMce","inElems","querySelectorAll","inElemObj","elementOptionsSet","capture","hexToRgb","hex","result","rgbToHex","rgb","isHex","rgbm","round","toString","toUpperCase","slice","test","icon_directory","hostName","protocol","hostname","img","src","wptbDropHandles","wptbDropBorderMarkers","linkHttpCheckChange","link","convertToAbs","currentLocation","origin","linkArr","linkClean","cls","parentElement","row","parent","getSelectionText","txt","getSelection","selection","elementOptionsPanelClear","elementOptionsGroup","wpColorPickerCheckChangeForTableStateSaving","originalEvent","wpPickerContainer","irisStripMouseUpStateSaveManager","wpColorPickerClear","attribute","isId","input","newInput","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","wpColorPickerChange","ui","uiColor","color","classe","ps","number","affectedEl","backgroundColor","ratingStar","span","fill","wptbTextMessageSize","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","ucfirst","str","charAt","eventName","details","CustomEvent","detail","bubbles","dispatchEvent","WPTB_ElementsScriptsLauncher","deleteEventHandlers","off","elementChildren","replaceAll","string","search","join","mceContentBodys","k","dataMceStyle","mceEditFocus","contentEditable","spellCheck","mceIds","elementOptionContainerCustomClassSet","targetInput","customClassForContainer","containerElement","elementOptionContainerAdditionalStyles","containerAdditionalStyles","containerStylesArrOne","containerStylesSet","containerStyleStr","containerStyleStrArr","controlsInclude","functionHandler","acceptEventValues","controlConnectFunctionsName","name","elementKind","elementOptionsGroupIds","optionsGroupIds","elementOptionsGroupId","controlActiveElements","map","controlInfArr","controlActiveElement","controlUnicClassName","controls","controlName","control","targetControlValue","targetControlValueGet","targetValue","eventValue","oneControlInclude","wptbContrlStacksConfigId","tmplControlsConfig","container","jsonControlsConfigJson","jsonControlsConfig","controlClassName","innerElementCopyIncludeHandler","appearDependOnControl","dependOn","targetControlElementClass","dependOnControlName","dependOnControlElementClass","dependOnControlElement","targetControlElement","controlContainerElem","showHideDependOnControlElement","dependOnControlElements","childCheck","checked","controlsStateManager","targetControlClass","controlChangeIndic","targetControls","selectorElement","elementsSettingsTemplatesJs","elementSettings","elementsSettings","stringify","alignmentValue","elementControlsStateCopy","elementProt","copyElem","infArrProt","infArrCopy","elemProtKind","elemCopyKind","elementsSettingsTemplateJs","elementSettingsProt","elementSettingsCopy","Object","keys","forEach","elementSettingValue","elementSettingKeyCopy","elementControlsStateDelete","nameControl","wptbElementDatas","elementContainerClass","elementOptionClassIndic","controlElementParent","elementOptionsScriptsContainer","cellEditActiveClass","activateSection","wptbelementOptionClass","childNodes","elementOptionsGroupIdsInvolved","elementOptionsGroupInvolved","elementOptionsContainerInvolved","controlScriptsObj","controlappearDependOnControl","elementOptionsScriptsContainerIndic","controlKey","tmplControlTemplate","elemContainer","elementControlTargetUnicClass","controlTemplate","elementOptionsContainerInvolvedGet","elementOptionsContainer","elementOptionsGroupChildren","elementOptionsContainerOn","elementOptionContainerOn","elementOptionContainer","elementOptionClass","helperJavascriptElem","helperJavascriptCode","innerText","script","controlScriptsArr","managerExternalCssStyles","elementContainer","selector","cssName","cssValue","head","cssForThisElement","cssText","cssTextArrFirst","pop","selectorExists","cssTextArrSecond","cssTextArrThird","cssNameExists","cssTextArrFourth","splice","registerSections","sections","currentSection","sectionElement","s","sectionDataId","displayType","triggerSectionEvent","prototype","call","visibility","getCurrentSection","getSectionFromUrl","parsedUrl","URL","urlSection","searchParams","get","some","setupSectionButtons","sectionButtons","from","vm","sectionName","wptbSectionButton","wptbSectionDisplayType","setupPanelToggleButtons","$","each","find","click","slideToggle","toggleClass","sectionEvent","setupSidebarToggle","toggleSelector","toggleButton","toggle","externalCssStylesDelete","externalCssStylesCopy","copyElement","activeElemClass","cssForActiveElement","cssForNewElement","infArrCopyEl","cssForActiveElementInnerHTML","cssForNewElementInnerHTML","elementsStylesConvertToObject","stylesElements","stylesObj","styleElemId","getAttribute","elementsStylesSetFromObject","jsonObject","styleCss","saveTable","startSaving","previewSaving","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","toggleTableEditMode","wptb_admin_object","t","messagingArea","code","datas","postId","rs","wptbId","paramIdsNecessaryChange","codeClone","wptbTableSetup","columns","WPTB_Stringifier","outerHTML","datas_containers","styleObjJson","messagingAreaText","setTimeout","params","title","content","elements_datas","elements_styles","security_code","preview_saving","id","action","builderPageUrl","history","pushState","wptbPreviewTable","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","clickOnFreeSpace","cellModeBackground","wpcdFixedToolbar","hasAttribute","elementAjax","dataAjaxData","element_name","element_ajax_data","close","leftScrollPanelCurtain","leftScrollPanelCellSettings","toggleEditMode","deactivateMultipleSelectMode","wptbPreviewTableTds","activateMultipleSelectMode","checkingDimensionValue","dimension","searchIndex","checkSetGetStyleSizeValue","styleName","computedStyleName","elemStyleValue","elementStyles","checkSetGetStyleColorValue","set","elemStyleColorValue","checkSetGetStyleValue","getValueMaxCountSameElementsInArray","arr","check","maxPropName","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","colSpan","rowSpan","z","tableRowsColorsReinstall","tableIndex","tableHeaderBackground","tableEvenRowBackground","tableOddRowBackground","parentType","dragRelativeType","setDragRelativeType","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","rows","WptbResponsive","div","classId","parentCell","elemKind","onmouseover","WPTB_LeftPanel","wptbElementButtons","wptbElement","wptbTablesEditModeCloseButton","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","wptbHeader","selectedCells","multipleCellMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","first","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","columnTitleMobile","hasDontEnumBug","propertyIsEnumerable","dontEnums","dontEnumsLength","obj","TypeError","prop","responsiveWrapperId","mainContainerQuery","responsiveTable","loaded","addContainerToDom","responsiveContainer","mainContainer","Error","responsiveElement","load","WPTB_ControlsManager","callControlScript","startUp","tablePreview","elems","wptbRelativeElements","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","previewId","floor","random","newHref","tableTitleField","onchange","codeMain","tableColumns","minWidth","innerElements","wptbActionsLength","dataMceBogus","array","wptb_preview_table","maxAmountOfCells","maxAmountOfRows","mark","cs","noCells","singleCells","multipleCells","cellSettings","position","column","cellHighlighted","markedCells","controlElemIds","elementControlSizeUnicClass","elementControlSizeFixedUnicClass","sizeName","getSizeFunctionName","size","cellSizeInputs","cellSizeFixedInput","isSquare","settingId","settingElem","countMarkedCells","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","a","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","skipInCols","reconstraction","insertRow","borderWidth","setMaxAmountOfCells","getMaxAmountOfCells","addColumnWidth","cleaner","highlighted","dataXIndex","tableTdsFor","colspan","tableRows","widthIsSet","arrayTdsFromPreviousRow","wptbFixedWidth","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTdWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","cssForTdsWidthAutoOld","wptbTableAlignment","float","addRowHeight","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","wptbFixedHeight","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","newTd","nextSib","r","aux","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","p","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","Number","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","thisRowChildren","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","onresize","generate","wptbTableStateSaving","wptbNewTableSetup","wptbHighlighted","wptbDirectlyhovered","cssForTdsWidthAutoValue","wptbTableTitle","wptbSetupName","datawptbUndoredo","wptbTableSetupNew","wptbLeftScrollPanelCellSetting","tableStateClear"],"mappings":";;;;AAAA,IAAIA,2BAA2B,SAA3BA,wBAA2B,CAAWC,OAAX,EAAoBC,aAApB,EAAkD;AAAA,QAAfC,IAAe,uEAAR,KAAQ;;AAC7E,QAAIC,OAAOH,QAAQI,aAAR,EAAX;AAAA,QACIC,KADJ;AAAA,QAEIH,IAFJ;AAGA,QAAIC,KAAKG,SAAL,CAAeC,QAAf,CAAyB,iBAAzB,CAAJ,EAAmD;AAC/C,YAAKN,iBAAiBO,SAAjB,IAA8BN,QAAQ,IAA3C,EAAkD;AAC9C;AACA,gBAAIO,eAAeC,SAASC,sBAAT,CAAiC,iBAAjC,CAAnB;AACA,gBAAIC,oBAAoB,EAAxB;AACA,iBAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIJ,aAAaK,MAAjC,EAAyCD,GAAzC,EAA+C;AAC3C,oBAAIE,QAAQ,IAAIC,MAAJ,CAAY,kBAAkBhB,QAAQiB,IAA1B,GAAiC,SAA7C,EAAwD,GAAxD,CAAZ;AACA,oBAAIC,SAAST,aAAaI,CAAb,EAAgBM,SAAhB,CAA0BC,KAA1B,CAAiCL,KAAjC,CAAb;AACA,oBAAIG,MAAJ,EAAa;AACTN,sCAAkBS,IAAlB,CAAwBH,OAAO,CAAP,CAAxB;AACH;AACJ;AACD,gBAAIN,kBAAkBE,MAAlB,GAA2B,CAA/B,EAAmC;AAC/B,oBAAIQ,kBAAkBC,KAAKC,GAAL,aAAaZ,iBAAb,CAAtB;AACAP,wBAAQiB,kBAAkB,CAA1B;AACH,aAHD,MAGO;AACHjB,wBAAQ,CAAR;AACH;;AAED,gBAAIH,IAAJ,EAAW;AACP;AACA,oBAAIu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,MAAZ,GAAqB,CAAzB,EAA6B;AACzBqlB,0BAAcA,YAAY,CAAZ,CAAd;;AAEAA,wBAAY/jB,eAAZ,CAA6B,mCAA7B;AACH;;AAED,YAAI0rB,WAAWptB,SAASC,sBAAT,CAAiC,WAAjC,CAAf;AACA,YAAImtB,SAAShtB,MAAT,GAAkB,CAAtB,EAA0B;AACtBgtB,uBAAWA,SAAS,CAAT,CAAX;;AAEAA,qBAASxtB,SAAT,CAAmBoC,GAAnB,CAAwB,wBAAxB;AACH;;AAED,YAAIwrB,WAAWxtB,SAASC,sBAAT,CAAiC,WAAjC,CAAf;AACA,YAAIutB,SAASptB,MAAT,GAAkB,CAAtB,EAA0B;AACtBotB,uBAAWA,SAAS,CAAT,CAAX;;AAEAA,qBAAS5tB,SAAT,CAAmBoC,GAAnB,CAAwB,wBAAxB;AACH;AACJ,KAxBD;AAyBH,CAzQD","file":"admin.js","sourcesContent":["var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\r\n var node = element.getDOMElement(),\r\n index,\r\n copy;\r\n if( node.classList.contains( 'wptb-ph-element' ) ) {\r\n if ( kindIndexProt == undefined || copy == true ) {\r\n //index = document.counter.nextIndex( element.kind );\r\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\r\n let elementIndexesArr = [];\r\n for( let i = 0; i < wptbElements.length; i++ ) {\r\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\r\n let infArr = wptbElements[i].className.match( regex );\r\n if( infArr ) {\r\n elementIndexesArr.push( infArr[1] );\r\n }\r\n }\r\n if( elementIndexesArr.length > 0 ) {\r\n let elementIndexMax = Math.max( ...elementIndexesArr );\r\n index = elementIndexMax + 1;\r\n } else { \r\n index = 1;\r\n }\r\n\r\n if( copy ) {\r\n // change all data-elements which save parameters for different controls\r\n let wptbNodeattributes = [...node.attributes];\r\n for( let i = 0; i < wptbNodeattributes.length; i++ ) {\r\n if( wptbNodeattributes[i] && typeof wptbNodeattributes[i] === 'object' && wptbNodeattributes[i].nodeName ) {\r\n let regularText = new RegExp( 'data-wptb-el-' + element.kind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\r\n let attr = wptbNodeattributes[i].nodeName.match( regularText );\r\n if( attr && Array.isArray( attr ) ) {\r\n let newDataAttributeName = wptbNodeattributes[i].nodeName.replace( element.kind + '-' + attr[1], element.kind + '-' + index );\r\n let newDataAttributeValue = wptbNodeattributes[i].nodeValue;\r\n node.removeAttribute( wptbNodeattributes[i].nodeName );\r\n node.setAttribute( newDataAttributeName, newDataAttributeValue );\r\n }\r\n }\r\n }\r\n }\r\n } else if ( kindIndexProt && ! copy ) {\r\n let kindIndexProtArr = kindIndexProt.split('-');\r\n index = kindIndexProtArr[kindIndexProtArr.length - 1];\r\n // start element javascript if element is new\r\n \r\n }\r\n\r\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if ( node_wptb_element_kind_num ) {\r\n node.classList.remove( node_wptb_element_kind_num[0] );\r\n }\r\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\r\n node.classList.add( 'wptb-ph-element' );\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n } else {\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n }\r\n WPTB_Helper.elementStartScript( element.getDOMElement() );\r\n new WPTB_ElementOptions( element, index, kindIndexProt );\r\n document.counter.increment(element.kind);\r\n }\r\n \r\n node.onmouseenter = function ( event ) {\r\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\r\n return;\r\n }\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n node.classList.remove( 'wptb-ondragenter' );\r\n };\r\n \r\n node.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.leaveFromField( event, node );\r\n };\r\n};","var WPTB_ActionsField = function() {\r\n //this.wptbBorderMarker;\r\n this.wptbActions;\r\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\r\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\r\n }\r\n \r\n this.addActionField = ( actionType, thisNode ) => {\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n \r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length != 0 ) {\r\n let previousNode = actions[0].activeElem;\r\n if( previousNode ) {\r\n previousNode.classList.remove( 'wptb-directlyhovered' );\r\n }\r\n \r\n while( actions.length != 0 ) {\r\n actions[0].parentNode.removeChild( actions[0] );\r\n }\r\n }\r\n \r\n if( actionType == 1 ) {\r\n \r\n let btnDelete, btnCopy;\r\n\r\n btnDelete = document.createElement( 'span' ),\r\n btnCopy = document.createElement( 'span' ),\r\n actions = document.createElement( 'div' );\r\n\r\n actions.classList.add( 'wptb-actions' );\r\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\r\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\r\n \r\n actions.appendChild( btnCopy );\r\n actions.appendChild( btnDelete );\r\n \r\n body.appendChild( actions );\r\n\r\n actions.activeElem = thisNode;\r\n\r\n actions.type = 1;\r\n\r\n btnDelete.onclick = function( event ) {\r\n let act = event.target.parentNode.activeElem,\r\n el = act.parentNode;\r\n let infArr = act.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n// if( act && infArr && Array.isArray( infArr ) ) {\r\n// WPTB_Helper.elementControlsStateDelete( act );\r\n// WPTB_Helper.externalCssStylesDelete( infArr[0] );\r\n// }\r\n \r\n if( act ) {\r\n el.removeChild( act );\r\n }\r\n\r\n if( act && typeof act === 'object' && act.hasOwnProperty( 'kind' ) && act.kind == 'text' ) {\r\n let thisRow = el.parentNode;\r\n \r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n\r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n }\r\n\r\n let wptbActionsField = new WPTB_ActionsField();\r\n wptbActionsField.actionsRemove();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n btnCopy.onclick = ( event ) => {\r\n let copy,\r\n infArr,\r\n type;\r\n let activeElement = event.target.parentNode.activeElem;\r\n let activeElemParent = activeElement.parentNode;\r\n infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n type = infArr[1];\r\n let data = {};\r\n data.kind = type;\r\n data.elemProt = activeElement;\r\n data.tinyMceClear = true;\r\n copy = new WPTB_ElementObject( data );\r\n //WPTB_Helper.elementControlsStateCopy( activeElement, copy.getDOMElement() );\r\n //WPTB_Helper.externalCssStylesCopy( activeElement, copy.getDOMElement() );\r\n //WPTB_Helper.elementStartScript( copy.getDOMElement() );\r\n \r\n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\r\n } else {\r\n copy = {};\r\n let elementCopy = activeElement.cloneNode( true );\r\n elementCopy.classList.remove( 'wptb-directlyhovered' );\r\n \r\n copy.getDOMElement = function() {\r\n return elementCopy;\r\n }\r\n \r\n applyGenericItemSettings( copy );\r\n \r\n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\r\n \r\n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-inner-element:copy', activeElement, copy.getDOMElement() );\r\n }\r\n \r\n WPTB_innerElementSet( copy.getDOMElement() );\r\n\r\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\r\n wptbActionsField.setParameters( activeElement );\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n \r\n if( thisNode.classList.contains( 'wptb-ph-element' ) ) {\r\n let btnMove;\r\n btnMove = document.createElement( 'span' );\r\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\r\n btnMove.draggable = true;\r\n actions.appendChild( btnMove );\r\n \r\n btnMove.ondragstart = ( event ) => {\r\n let wptbElementIconsDirectories = 'wptb-element-icons-directories';\r\n let tmplIconsDirectories = wp.template( wptbElementIconsDirectories );\r\n let data = {};\r\n let jsonIconsDirectories = tmplIconsDirectories( data );\r\n let IconsDirectories = JSON.parse( jsonIconsDirectories );\r\n\r\n let dragImages,\r\n actions = event.target.parentNode,\r\n activeElem = actions.activeElem,\r\n infArr,\r\n type;\r\n infArr = activeElem.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n type = infArr[1];\r\n activeElem.classList.add( 'wptb-moving-mode' );\r\n\r\n if( IconsDirectories && typeof IconsDirectories === 'object' && IconsDirectories[type] ) {\r\n dragImages = WPTB_Helper.getElementIcon( IconsDirectories[type] );\r\n }\r\n\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setDragImage( dragImages, 0, 0 );\r\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\r\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\r\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\r\n let act = event.target.parentNode.activeElem;\r\n if( act.kind == 'text' ) {\r\n let thisRow = act.parentNode.parentNode;\r\n \r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n\r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n }\r\n } else {\r\n this.style.display = 'none';\r\n }\r\n\r\n this.actionsHide();\r\n };\r\n\r\n btnMove.ondragend = ( event ) => {\r\n WPTB_Helper.elementDragEndClear();\r\n }\r\n }\r\n\r\n actions.style.display = 'flex';\r\n\r\n this.wptbActions = actions;\r\n } \r\n }\r\n \r\n this.setParameters = ( thisNode ) => {\r\n \r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n } else {\r\n this.wptbActions = false;\r\n }\r\n }\r\n \r\n if( this.wptbActions && this.wptbActions.classList.contains( 'wptb-actions' ) ) {\r\n this.wptbActions.style.display = 'flex';\r\n } else {\r\n return;\r\n }\r\n \r\n let coordinatesElement = thisNode.getBoundingClientRect();\r\n \r\n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\r\n let correctTop = () => {\r\n let coordinatesElement = thisNode.getBoundingClientRect();\r\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\r\n }\r\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\r\n \r\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\r\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\r\n \r\n this.wptbActions.style.display = 'flex';\r\n thisNode.classList.add( 'wptb-directlyhovered' );\r\n \r\n wptbContainer.addEventListener( 'scroll', correctTop, false );\r\n }\r\n \r\n this.leaveFromField = ( event, node, actionType ) => {\r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n } else {\r\n this.wptbActions = false;\r\n }\r\n }\r\n \r\n if( ! this.wptbActions ) {\r\n return;\r\n }\r\n \r\n if( event.relatedTarget ) {\r\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\r\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\r\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\r\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\r\n if( ! this.wptbActions ) {\r\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\r\n }\r\n this.wptbActions.onmouseleave = ( event ) => {\r\n if( event.relatedTarget != null && ( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || \r\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element') ) && event.relatedTarget != this.wptbActions.activeElem &&\r\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered' ) != this.wptbActions.activeElem ) {\r\n \r\n// this.wptbActions.style.display = 'none';\r\n// event.relatedTarget.parentNode.parentNode.classList.remove( 'wptb-directlyhovered' );\r\n//\r\n// let wptbActionsField = new WPTB_ActionsField();\r\n//\r\n// wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\r\n//\r\n// wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\r\n } else {\r\n \r\n }\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.leaveFromField( event, event.relatedTarget.parentNode.parentNode );\r\n \r\n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\r\n }\r\n\r\n return;\r\n } \r\n }\r\n \r\n node.classList.remove( 'wptb-directlyhovered' );\r\n this.wptbActions.style.display = 'none';\r\n \r\n if( event.relatedTarget ) {\r\n if( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element' ) ) {\r\n this.addActionField( 1, event.relatedTarget.parentNode );\r\n\r\n this.setParameters( event.relatedTarget.parentNode );\r\n }\r\n }\r\n }\r\n \r\n this.actionsRemove = () => {\r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n }\r\n }\r\n \r\n if( this.wptbActions ) {\r\n this.wptbActions.parentNode.removeChild( this.wptbActions );\r\n }\r\n }\r\n \r\n this.actionsHide = () => {\r\n if( ! this.wptbActions ) {\r\n let actions = document.getElementsByClassName( 'wptb-actions' );\r\n if( actions.length > 0 ) {\r\n this.wptbActions = actions[0];\r\n }\r\n }\r\n \r\n if( this.wptbActions ) {\r\n this.wptbActions.style.opacity = 0;\r\n }\r\n }\r\n}","(function () {\r\n var WPTB_Builder = function () {\r\n var table_id = WPTB_Helper.detectMode();\r\n if ( table_id ) {\r\n var http = new XMLHttpRequest(),\r\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\r\n http.open('GET', urlSet, true);\r\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\r\n http.onreadystatechange = function (d) {\r\n if (this.readyState == 4 && this.status == 200) {\r\n var ans = JSON.parse( http.responseText );\r\n document.getElementById('wptb-setup-name').value = ans[0];\r\n \r\n if( ans[1] ) {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\r\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\r\n \r\n let body = document.getElementsByTagName('body')[0];\r\n \r\n WPTB_Table();\r\n let element = document.querySelector( '.wptb-preview-table' );\r\n if( element ) {\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( ! infArr ) {\r\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\r\n }\r\n \r\n if( element.dataset.wptbTableContainerMaxWidth ) {\r\n wptbTableSetupEl.style.maxWidth = element.dataset.wptbTableContainerMaxWidth + 'px';\r\n \r\n element.tdDefaultWidth();\r\n }\r\n }\r\n \r\n //WPTB_LeftPanel();\r\n WPTB_Settings();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n return;\r\n }\r\n };\r\n http.send(null);\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n document.counter = new ElementCounters();\r\n document.select = new MultipleSelect();\r\n\r\n var initializer = WPTB_Initializer();\r\n settings = WPTB_Settings();\r\n };\r\n\r\n let url = window.location.href,\r\n regex = new RegExp('[?&]page=wptb-builder'),\r\n results = regex.exec( url );\r\n if ( results ) {\r\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\r\n }\r\n})();","var WPTB_Cell = function ( callback, DOMElement ) {\r\n\r\n function highlightRow(td) {\r\n var parentRow = td.parentNode,\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\r\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\r\n }\r\n for (var i = 0; i < columnCount; i++) {\r\n\r\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\r\n var ttd = parentRow.getElementsByTagName('td')[i];\r\n if (ttd !== td) {\r\n ttd.classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n\r\n function highlightColumn(td) {\r\n\r\n var index,\r\n parentRow = td.parentNode;\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\r\n for (var i = 0; i < columnCount; i++) {\r\n if (parentRow.getElementsByTagName('td')[i] === td) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n for (var i = 0; i < rowCount; i++) {\r\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\r\n var tr = table.getElementsByTagName('tr')[i];\r\n if (tr.getElementsByTagName('td')[index] !== td) {\r\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n \r\n if( ! DOMElement ) {\r\n DOMElement = document.createElement(\"td\");\r\n\r\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\r\n\r\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\r\n\r\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\r\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\r\n } \r\n\r\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\r\n }\r\n\r\n DOMElement.draggable = false;\r\n if ( callback ) {\r\n DOMElement.onclick = callback;\r\n }\r\n \r\n // Cell double click handler\r\n DOMElement.ondblclick = function( event ) {\r\n event.stopPropagation();\r\n if( ! WPTB_Helper.findAncestor( DOMElement, 'wptb-preview-table-manage-cells' ) && event.target == event.currentTarget ) {\r\n \r\n WPTB_Helper.wptbDocumentEventGenerate( 'table:cell:dblclick', event.target );\r\n \r\n let element = WPTB_Helper.newElementProxy( 'text' );\r\n element = element.getDOMElement();\r\n \r\n DOMElement.appendChild( element );\r\n \r\n WPTB_innerElementSet( element );\r\n }\r\n }\r\n \r\n WPTB_innerElementSet( DOMElement );\r\n\r\n WPTB_Helper.elementStartScript( DOMElement, 'table_cell_setting' );\r\n\r\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( wptbPhElement.length > 0 ) {\r\n for( let i = 0; i < wptbPhElement.length; i++ ) {\r\n wptbPhElement[i].getDOMElement = function() {\r\n return wptbPhElement[i];\r\n }\r\n \r\n WPTB_innerElementSet( wptbPhElement[i] );\r\n \r\n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\r\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\r\n wptbPhElement[i].kind = wptbTypeElementArr[0];\r\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\r\n let wptbInternalActiveElement = wptbPhElement[i].getElementsByClassName( 'wptb-in-element' );\r\n if ( wptbInternalActiveElement.length > 0 ) {\r\n for ( let j = 0; j < wptbInternalActiveElement.length; j++ ) {\r\n let wptbInternalActiveElementObj = {};\r\n wptbInternalActiveElementObj.getDOMElement = function() {\r\n return wptbInternalActiveElement[j];\r\n }\r\n \r\n applyGenericItemSettings( wptbInternalActiveElementObj );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n this.setCoords = function (y, x) {\r\n var el = this.getDOMElement();\r\n el.dataset.yIndex = y;\r\n el.dataset.xIndex = x;\r\n };\r\n\r\n this.getCoords = function () {\r\n var coords,\r\n el = this.getDOMElement();\r\n coords.x = el.dataset.xIndex;\r\n coords.y = el.dataset.yIndex;\r\n return coords;\r\n };\r\n\r\n this.appendElement = function (node) {\r\n getDOMElement().appendChild(node);\r\n };\r\n \r\n DOMElement.getCellDimensions = function() {\r\n\r\n let tdStyleObj = window.getComputedStyle( this, null );\r\n\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n\r\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n\r\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\r\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\r\n\r\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\r\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\r\n\r\n let width = parseInt( this.offsetWidth, 10 ) -\r\n parseInt( tdPaddingLeft, 10 ) -\r\n parseInt( tdPaddingRight, 10 );\r\n\r\n let height = parseInt( this.offsetHeight, 10 ) -\r\n parseInt( tdPaddingTop, 10 ) -\r\n parseInt( tdPaddingBottom, 10 );\r\n let table = WPTB_Helper.findAncestor( this, 'wptb-preview-table' );\r\n if(table) {\r\n if(table.style.borderCollapse === 'collapse') {\r\n width = width - ( parseInt( tdBorderLeftWidth, 10 ) / 2 ) -\r\n ( parseInt( tdBorderRightWidth, 10 ) / 2 );\r\n height = height - ( parseInt( tdBorderTopWidth, 10 ) / 2 ) -\r\n ( parseInt( tdBorderBottomWidth, 10 ) / 2 );\r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let tableBorderLeft = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableBorderRight = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderTop = tableFullStyleObj.getPropertyValue( 'border-top-width' );\r\n let tableBorderBottom = tableFullStyleObj.getPropertyValue( 'border-bottom-width' );\r\n\r\n let tr = this.parentNode;\r\n if( tr && tr.nodeName.toLowerCase() === 'tr' ) {\r\n if( tr.firstChild && tr.firstChild.dataset.xIndex === this.dataset.xIndex ) {\r\n if( parseInt( tableBorderLeft, 10 ) > parseInt( tdBorderLeftWidth, 10 ) ) {\r\n width += -( parseInt( tableBorderLeft, 10 ) - parseInt( tdBorderLeftWidth, 10 ) ) / 2;\r\n }\r\n }\r\n\r\n if( tr.lastChild && tr.lastChild.dataset.xIndex === this.dataset.xIndex ) {\r\n if( parseInt( tableBorderRight, 10 ) > parseInt( tdBorderRightWidth, 10 ) ) {\r\n width += -( parseInt( tableBorderRight, 10 ) - parseInt( tdBorderRightWidth, 10 ) ) / 2;\r\n }\r\n }\r\n\r\n let body = tr.parentNode;\r\n if( body && body.nodeName.toLowerCase() === 'body' ) {\r\n if( body.firstChild && body.firstChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\r\n if( parseInt( tableBorderTop, 10 ) > parseInt( tdBorderTopWidth, 10 ) ) {\r\n height += ( parseInt( tableBorderTop, 10 ) - parseInt( tdBorderTopWidth, 10 ) ) / 2;\r\n }\r\n }\r\n\r\n if( body.lastChild && body.lastChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\r\n if( parseInt( tableBorderBottom, 10 ) > parseInt( tdBorderBottomWidth, 10 ) ) {\r\n height += ( parseInt( tableBorderBottom, 10 ) - parseInt( tdBorderBottomWidth, 10 ) ) / 2;\r\n }\r\n }\r\n }\r\n }\r\n } else if(table.style.borderCollapse === 'separate') {\r\n width = width - parseInt( tdBorderLeftWidth, 10 ) -\r\n parseInt( tdBorderRightWidth, 10 );\r\n height = height - parseInt( tdBorderTopWidth, 10 ) -\r\n parseInt( tdBorderBottomWidth, 10 );\r\n }\r\n }\r\n\r\n return {\r\n width: parseInt( width ),\r\n height: parseInt( height )\r\n };\r\n }\r\n\r\n return this;\r\n};","var WPTB_DropHandle = function (thisElem, e, hide = false) {\r\n\r\n let wptbDropHandle,\r\n wptbDropBorderMarker,\r\n wptbDropBorderMarkerTop,\r\n wptbDropBorderMarkerRight,\r\n wptbDropBorderMarkerBottom,\r\n wptbDropBorderMarkerLeft;\r\n\r\n /**\r\n * Add px suffix to a value\r\n *\r\n * @param {any} val value\r\n * @returns {string} string value suffixed with px\r\n */\r\n function toPx(val){\r\n return `${val}px`;\r\n }\r\n\r\n if(WPTB_Helper.getDragRelativeType() === 'td_relative'){\r\n let cellRelatedDropHandle = document.querySelector('.wptb-cell-related-drop-handle');\r\n if(hide && cellRelatedDropHandle ){\r\n cellRelatedDropHandle.style.display = 'none';\r\n return;\r\n }\r\n if(cellRelatedDropHandle === null){\r\n const range = document.createRange();\r\n range.setStart(document.body , 0);\r\n\r\n const shadowRoot = range.createContextualFragment('<div class=\"wptb-cell-related-drop-handle\">Add to cell</div>').children[0];\r\n\r\n document.body.appendChild(shadowRoot);\r\n cellRelatedDropHandle = shadowRoot.children[0];\r\n }\r\n\r\n const parentTd = WPTB_Helper.getParentOfType('td', thisElem);\r\n const {top,left,width,height} = parentTd.getBoundingClientRect();\r\n\r\n if(!cellRelatedDropHandle){\r\n return;\r\n }\r\n\r\n cellRelatedDropHandle.style.display = 'flex';\r\n cellRelatedDropHandle.style.top = toPx(top);\r\n cellRelatedDropHandle.style.width = toPx(width);\r\n cellRelatedDropHandle.style.height = toPx(height);\r\n cellRelatedDropHandle.style.left = toPx(left);\r\n\r\n return;\r\n }\r\n\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\r\n wptbDropHandle = document.createElement( 'div' );\r\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\r\n \r\n wptbDropBorderMarker = document.createElement( 'div' );\r\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\r\n \r\n wptbDropBorderMarkerTop = document.createElement( 'div' ),\r\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\r\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\r\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\r\n \r\n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\r\n \r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\r\n \r\n let body = document.getElementsByTagName( 'body' );\r\n if ( body.length > 0 ) {\r\n body[0].appendChild( wptbDropHandle );\r\n body[0].appendChild( wptbDropBorderMarker );\r\n }\r\n \r\n wptbDropHandle.ondragenter = function () {\r\n if (e.target.classList.contains('wptb-empty')) {\r\n e.preventDefault();\r\n return false;\r\n }\r\n }\r\n\r\n wptbDropHandle.ondragover = function (e) {\r\n e.preventDefault(); \r\n }\r\n\r\n wptbDropHandle.ondragleave = function () {\r\n\r\n }\r\n wptbDropHandle.ondrop = function (e) {\r\n e.preventDefault();\r\n let element;\r\n \r\n if ( e.dataTransfer.getData('wptbElement') ) {\r\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData('wptbElement') );\r\n element = element.getDOMElement();\r\n } else {\r\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\r\n element.classList.remove( 'wptb-moving-mode' );\r\n element.classList.remove( 'wptb-moving-into-same-elem' );\r\n element.wptbMovingMode = 1;\r\n }\r\n \r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n thisElem = wptbDropHandle.getDOMParentElement();\r\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n }\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n \r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode;\r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n\r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n \r\n WPTB_innerElementSet( element );\r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n element.wptbMovingMode == undefined;\r\n }\r\n }\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n wptbContainer.onscroll = function() {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n } else {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0) {\r\n return;\r\n }\r\n\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.classList.contains('wptb-empty')) {\r\n return;\r\n }\r\n \r\n let thisRow;\r\n if ( thisElem.localName == 'td' ) {\r\n thisRow = thisElem.parentNode;\r\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\r\n thisRow = thisElem.parentNode.parentNode;\r\n }\r\n \r\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n \r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n let indics = e.dataTransfer.types;\r\n let notDragEnter = false;\r\n for ( let i = 0; i < indics.length; i++ ) {\r\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\r\n if ( infArr && infArr[1] != 'text' ) {\r\n notDragEnter = true;\r\n break;\r\n }\r\n }\r\n if( notDragEnter ) {\r\n return;\r\n }\r\n }\r\n }\r\n \r\n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\r\n let height = thisElem.offsetHeight,\r\n coordinatesElement = thisElem.getBoundingClientRect(),\r\n left = parseFloat( coordinatesElement.left ),\r\n top;\r\n wptbDropHandle.style.left = left + 'px';\r\n \r\n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\r\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\r\n if( thisElem == elementDrag ) {\r\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\r\n } else {\r\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\r\n }\r\n }\r\n \r\n wptbDropHandle.getDOMParentElement = function() {\r\n return thisElem;\r\n }\r\n \r\n wptbDropHandle.style.display = 'block';\r\n wptbDropBorderMarker.style.display = 'block';\r\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\r\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\r\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\r\n wptbDropHandle.dataset.text = 'Above Element';\r\n if ( y > height/2 ) {\r\n top = parseFloat( coordinatesElement.top ) + height - 1;\r\n wptbDropHandle.dataset.text = 'Below Element';\r\n }\r\n } else {\r\n wptbDropHandle.dataset.text = 'Drop Here';\r\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\r\n }\r\n wptbDropHandle.style.top = top + 'px';\r\n\r\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\r\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\r\n\r\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\r\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\r\n\r\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\r\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\r\n\r\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\r\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\r\n}","var ElementCounters = function () {\r\n\r\n\tvar priv = [];\r\n\tpriv['text'] = 0;\r\n\tpriv['image'] = 0;\r\n\tpriv['list'] = 0;\r\n\tpriv['button'] = 0;\r\n\r\n\tthis.increment = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpriv[key]++;\r\n\t}\r\n\r\n\tthis.nextIndex = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn priv[key] + 1;\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_ElementObject = function ( data ) {\r\n let DOMElement, kindIndexProt, copy;\r\n if( ! data.elemProt ) {\r\n DOMElement = document.createElement('div'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n DOMElement.classList.add( 'wptb-' + data.kind + '-container', 'wptb-ph-element' );\r\n \r\n let wpTemplateId = 'wptb-' + data.kind + '-content';\r\n let template = wp.template( wpTemplateId );\r\n data.node = DOMElement;\r\n let itemHtml = template( data );\r\n\r\n itemHtml = itemHtml.replace(/\\r|\\n|\\t/g, '').trim();\r\n DOMElement.innerHTML = itemHtml;\r\n } else {\r\n DOMElement = data.elemProt.cloneNode( true );\r\n DOMElement.classList.remove( 'wptb-directlyhovered' );\r\n let wptbElementMutch = data.elemProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n };\r\n copy = true;\r\n \r\n if( data.tinyMceClear ) {\r\n DOMElement = WPTB_Helper.elementClearFromTinyMce( DOMElement );\r\n }\r\n }\r\n \r\n let inElems = DOMElement.querySelectorAll( '.wptb-in-element' );\r\n if( inElems.length > 0 ) {\r\n for ( let i = 0; i < inElems.length; i++ ) {\r\n let inElemObj = {};\r\n inElemObj.getDOMElement = function() {\r\n return inElems[i];\r\n }\r\n \r\n applyGenericItemSettings( inElemObj );\r\n }\r\n }\r\n \r\n window.addEventListener( 'item:onmouseenter', function( event ) {\r\n //console.log( event );\r\n }, false);\r\n \r\n \r\n this.kind = data.kind;\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n \r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n return this;\r\n}\r\n\r\n\r\n","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\r\n\r\n var node = element.getDOMElement();\r\n node.addEventListener( 'click', function() {\r\n WPTB_Helper.elementOptionsSet( element.kind, this );\r\n }, {capture: true} );\r\n};","var WPTB_Helper = {\r\n hexToRgb: function( hex ) {\r\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\r\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\r\n },\r\n rgbToHex: function ( rgb ) {\r\n if( rgb ) {\r\n if( WPTB_Helper.isHex( rgb ) ) return rgb;\r\n\r\n let rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?((?:[0-9]*[.])?[0-9]+)[\\s+]?\\)/i);\r\n if ( rgbm && rgbm.length === 5) {\r\n return \"#\" +\r\n ('0' + Math.round(parseFloat(rgbm[4], 10) * 255).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\r\n } else {\r\n rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\r\n if (rgbm && rgbm.length === 4) {\r\n return \"#\" +\r\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\r\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\r\n } else {\r\n return '';\r\n }\r\n }\r\n } else {\r\n return '';\r\n }\r\n\r\n },\r\n isHex: function( hex ) {\r\n let regex = new RegExp('^#(?:[A-Fa-f0-9]{3}){1,2}$');\r\n return regex.test( hex );\r\n },\r\n getElementIcon: function ( icon_directory ) {\r\n let hostName = location.protocol + '//' + location.hostname;\r\n let img = document.createElement( 'img' );\r\n img.src = icon_directory;\r\n return img;\r\n },\r\n elementDragEndClear: function() {\r\n let wptbMovingMode = document.getElementsByClassName( 'wptb-moving-mode' );\r\n if ( wptbMovingMode.length > 0 ) {\r\n for( let i = 0; i < wptbMovingMode.length; i++ ) {\r\n wptbMovingMode[i].classList.remove( 'wptb-moving-mode' );\r\n }\r\n }\r\n\r\n let wptbDropHandles = document.getElementsByClassName( 'wptb-drop-handle' );\r\n if ( wptbDropHandles.length > 0 ) {\r\n for( let i = 0; i < wptbDropHandles.length; i++ ) {\r\n wptbDropHandles[i].style.display = 'none';\r\n }\r\n }\r\n\r\n let wptbDropBorderMarkers = document.getElementsByClassName( 'wptb-drop-border-marker' );\r\n if ( wptbDropBorderMarkers.length > 0 ) {\r\n for( let i = 0; i < wptbDropBorderMarkers.length; i++ ) {\r\n wptbDropBorderMarkers[i].style.display = 'none';\r\n }\r\n }\r\n },\r\n linkHttpCheckChange: function( link, convertToAbs = false ) {\r\n if ( link ) {\r\n // even though it is not a best practice and a huge security risk, sometimes our users use javascript tag at href attributes, this check will make sure those tags will not be modified and returned as they are\r\n if(link.match(/^(javascript:)(.+)$/)){\r\n return link;\r\n }\r\n // relative link checking\r\n // if link starts with '/', assume it is a relative link to the origin of the current site\r\n else if( link.match(/^\\/([\\S]+)$/) ){\r\n if (convertToAbs) {\r\n const currentLocation = document.location;\r\n let {origin} = currentLocation;\r\n\r\n\r\n // strip out the '/' at the end of the origin name if there is any\r\n if (origin.match(/^(.+)\\/$/)) {\r\n origin = origin.slice(-1);\r\n }\r\n\r\n return `${origin}${link}`;\r\n }else{\r\n return link;\r\n }\r\n }\r\n else if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\r\n let linkArr = link.split( '/' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n return document.location.protocol + '//' + linkClean;\r\n } else {\r\n return link;\r\n }\r\n } else {\r\n return '';\r\n }\r\n },\r\n dataTitleColumnSet: function( table ) {\r\n // TODO dataTitleColumnSet\r\n // let rows = table.rows,\r\n // rowHead = rows[0];\r\n // let computedStyleRowHead = getComputedStyle( rowHead );\r\n //\r\n // let rowHeadChildren = rowHead.children;\r\n // let contentsForHeader = {};\r\n // for( let i = 0; i < rowHeadChildren.length; i++ ) {\r\n // let tdElements = rowHeadChildren[i].children;\r\n //\r\n // for( let j = 0; j < tdElements.length; j++ ) {\r\n // let element = tdElements[j];\r\n // if( element.classList.contains( 'wptb-ph-element' ) ) {\r\n // let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n // if( infArr[1] == 'text' ) {\r\n // let p = element.querySelector( 'p' ),\r\n // textContent = p.textContent,\r\n // textAlign = p.style.textAlign;\r\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize,\r\n // element.style.color, computedStyleRowHead.backgroundColor, textAlign];\r\n // break;\r\n // }\r\n // }\r\n // }\r\n // if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\r\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '',\r\n // '', computedStyleRowHead.backgroundColor, ''];\r\n // }\r\n // }\r\n // for ( let i = 1; i < rows.length; i++ ) {\r\n // let thisRow = rows[i],\r\n // thisRowChildren = thisRow.children;\r\n // for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n // if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\r\n // thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\r\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\r\n // thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\r\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\r\n // thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\r\n // } else {\r\n // thisRowChildren[j].dataset.wptbTitleColumn = null;\r\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = null;\r\n // thisRowChildren[j].dataset.wptbTitleColumnColor = null;\r\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = null;\r\n // thisRowChildren[j].dataset.wptbTitleAlign = null;\r\n // }\r\n // }\r\n // }\r\n },\r\n findAncestor: function( el, cls ) {\r\n while ( ( el = el.parentElement ) && !el.classList.contains( cls ) );\r\n return el;\r\n },\r\n rowIsTop: function( row ) {\r\n var parent = row.parentNode;\r\n if( parent.children[0] == row ) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n },\r\n getSelectionText: function() {\r\n var txt = '';\r\n if (txt = window.getSelection) {\r\n txt = window.getSelection().toString();\r\n } else {\r\n txt = document.selection.createRange().text;\r\n }\r\n return txt;\r\n },\r\n elementOptionsPanelClear: function() {\r\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\r\n if( elementOptionsGroup ) {\r\n elementOptionsGroup.innerHTML = '';\r\n }\r\n },\r\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\r\n if( event.originalEvent.type == 'external' ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n if( event.originalEvent.type == 'square' || event.originalEvent.type == 'strip' ) {\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\r\n body.addEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\r\n }\r\n }\r\n }\r\n },\r\n irisStripMouseUpStateSaveManager: function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\r\n },\r\n wpColorPickerClear: function( attribute, isId ) {\r\n let input;\r\n if( isId ) {\r\n input = [document.getElementById( attribute )];\r\n input.length = 1;\r\n } else {\r\n input = document.getElementsByClassName( attribute );\r\n }\r\n for( let i = 0; i < input.length; i++ ) {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n let parent = wpPickerContainer.parentNode;\r\n parent.removeChild( wpPickerContainer );\r\n let newInput = document.createElement( 'input' );\r\n if( isId ) {\r\n newInput.setAttribute( 'id', attribute );\r\n } else {\r\n newInput.classList.add( 'wptb-element-property', attribute );\r\n }\r\n newInput.value = \"\";\r\n parent.appendChild( newInput );\r\n }\r\n }\r\n },\r\n detectMode: function() {\r\n var url = window.location.href,\r\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\r\n results = regex.exec(url);\r\n if ( ! results ) return false;\r\n if ( ! results[2] ) return '';\r\n return decodeURIComponent( results[2].replace(/\\+/g, ' ') );\r\n },\r\n getColumnWidth: function( table, cell ) {\r\n let xIndex = cell.dataset.xIndex;\r\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\r\n let cellWidth = cell.getCellDimensions().width;\r\n for( let i = 0; i < xIndexes.length; i++ ) {\r\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\r\n cellWidth = xIndexes[i].getCellDimensions().width;\r\n }\r\n }\r\n return cellWidth;\r\n },\r\n getRowHeight: function( table, cell ) {\r\n let yIndex = cell.dataset.yIndex;\r\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\r\n let cellHeight = cell.getCellDimensions().height;\r\n for( let i = 0; i < yIndexes.length; i++ ) {\r\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\r\n cellHeight = yIndexes[i].getCellDimensions().height;\r\n }\r\n }\r\n return cellHeight;\r\n },\r\n newElementProxy: function( el ) {\r\n if( el ) {\r\n let data = {kind: el};\r\n return new WPTB_ElementObject( data );\r\n }\r\n },\r\n wpColorPickerChange: function( event, ui ) {\r\n let uiColor;\r\n if( ui ) {\r\n uiColor = ui.color.toString();\r\n } else {\r\n uiColor = '';\r\n }\r\n\r\n let parent = WPTB_Helper.findAncestor( event.target, 'wp-picker-input-wrap' ).getElementsByClassName( 'wptb-color-picker' )[0], classe, type, ps, number;\r\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\r\n type = classe[1];\r\n number = classe[2];\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + type + '-' + number )[0];\r\n if ( type == 'button' ) {\r\n if ( parent.dataset.type == 'button-text-color' ) {\r\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.color = uiColor;\r\n } else {\r\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.backgroundColor = uiColor;\r\n }\r\n } else if( type == 'list' ) {\r\n let ps = affectedEl.querySelectorAll( 'p' );\r\n if( ps.length > 0 ) {\r\n for ( let i = 0; i < ps.length; i++ ) {\r\n ps[i].style.color = uiColor;\r\n }\r\n }\r\n } else if( type == 'star_rating' ) {\r\n if ( parent.dataset.type == 'star-color' ) {\r\n let ratingStar = affectedEl.querySelectorAll('li');\r\n for( let i = 0; i < ratingStar.length; i++ ) {\r\n let span = ratingStar[i].getElementsByTagName( 'span' );\r\n for( let j = 0; j < span.length; j++ ) {\r\n span[j].style.fill = uiColor;\r\n }\r\n }\r\n } else if( parent.dataset.type == 'numeral-rating-color' ) {\r\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-number-rating');\r\n wptbTextMessageSize.style.color = uiColor;\r\n }\r\n\r\n } else {\r\n affectedEl.style.color = uiColor;\r\n }\r\n },\r\n numberImputSize: function ( wptbNumberInputs, maxCount, maxValue ) {\r\n wptbNumberInputs.onkeydown = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue[0] == 0 ) {\r\n this.value = \"\";\r\n } else {\r\n thisValue = thisValue.substring( 0, maxCount );\r\n this.value = thisValue;\r\n }\r\n }\r\n wptbNumberInputs.onkeyup = function( ) {\r\n let thisValue = this.value;\r\n if ( parseInt( thisValue, 10 ) > parseInt( maxValue, 10 ) ) {\r\n this.value = maxValue;\r\n }\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n },\r\n ucfirst: function( str ) {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n },\r\n wptbDocumentEventGenerate: function( eventName, element, details ) {\r\n if( eventName && element ) {\r\n if( ! details ) {\r\n details = true;\r\n }\r\n let event = new CustomEvent( eventName, { detail: details, bubbles: true } );\r\n element.dispatchEvent( event );\r\n }\r\n },\r\n // run script for the pointed element\r\n elementStartScript: function( element, kind ) {\r\n //let script = element.getElementsByTagName( 'script' );\r\n if(!kind) {\r\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if( infArr && Array.isArray( infArr ) ) {\r\n kind = infArr[1];\r\n }\r\n }\r\n\r\n if( kind ) {\r\n// let wpTemplateId = 'wptb-' + kind + '-script';\r\n// let template = wp.template( wpTemplateId );\r\n// let data = {elemClass: infArr[0]};\r\n// let elementScriptText = template( data );\r\n// elementScriptText = elementScriptText.replace(/\\r|\\n|\\t/g, '').trim();\r\n//\r\n// let scriptNew = document.createElement( 'script' );\r\n// scriptNew.setAttribute( 'type', 'text/javascript' );\r\n// scriptNew.innerHTML = elementScriptText;\r\n// element.parentNode.appendChild( scriptNew );\r\n\r\n// element.parentNode.removeChild( scriptNew );\r\n if( kind in WPTB_ElementsScriptsLauncher ) {\r\n WPTB_ElementsScriptsLauncher[kind]( element );\r\n }\r\n }\r\n },\r\n // deletes event handlers from the pointed option element and from all his daughter elements\r\n deleteEventHandlers: function( element ) {\r\n if( element ) {\r\n jQuery( element ).off();\r\n let elementChildren = element.children;\r\n if( elementChildren ) {\r\n for ( let i = 0; i < elementChildren.length; i++ ) {\r\n WPTB_Helper.deleteEventHandlers( elementChildren[i] );\r\n }\r\n }\r\n } else {\r\n return;\r\n }\r\n },\r\n // replace all occurrences in a string\r\n replaceAll: function( string, search, replace ){\r\n return string.split( search ).join( replace );\r\n },\r\n // clears code from TinyMCE attributes\r\n elementClearFromTinyMce: function( element ) {\r\n let mceContentBodys = element.querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n\r\n let dataMceStyle = element.querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n\r\n let mceEditFocus = element.querySelectorAll( '.mce-edit-focus' );\r\n if( mceEditFocus.length > 0 ) {\r\n for ( let k = 0; k < mceEditFocus.length; k++ ) {\r\n mceEditFocus[k].classList.remove( 'mce-edit-focus' );\r\n }\r\n }\r\n\r\n let contentEditable = element.querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n\r\n let spellCheck = element.querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n\r\n let mceIds = element.querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n\r\n return element;\r\n },\r\n elementOptionContainerCustomClassSet: function( targetInput, customClassForContainer ) {\r\n if( targetInput && customClassForContainer ) {\r\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\r\n if( containerElement ) {\r\n containerElement.classList.add( customClassForContainer );\r\n }\r\n }\r\n },\r\n elementOptionContainerAdditionalStyles: function( targetInput, containerAdditionalStyles ) {\r\n if( targetInput && containerAdditionalStyles ) {\r\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\r\n let containerStylesArrOne = containerAdditionalStyles.split( ';' );\r\n\r\n if( containerElement && containerStylesArrOne ) {\r\n function containerStylesSet( containerStyleStr, containerElement ) {\r\n if( containerStyleStr ) {\r\n containerStyleStrArr = containerStyleStr.split( ':' );\r\n\r\n if( containerStyleStrArr && Array.isArray( containerStyleStrArr ) ) {\r\n containerElement.style[containerStyleStrArr[0]] = containerStyleStrArr[1];\r\n }\r\n }\r\n }\r\n if( containerStylesArrOne && Array.isArray( containerStylesArrOne ) ) {\r\n for( let i = 0; i < containerStylesArrOne.length; i++ ) {\r\n if( containerStylesArrOne[i] ) {\r\n containerStylesSet( containerStylesArrOne[i], containerElement );\r\n }\r\n }\r\n } else {\r\n containerStylesSet( containerStylesArrOne, containerElement );\r\n }\r\n }\r\n }\r\n },\r\n // function which set handler for event of changes of control\r\n controlsInclude: function( element, functionHandler, acceptEventValues = false ) {\r\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\r\n element.addEventListener( 'element:controls:active', function() {\r\n if(!element.hasOwnProperty('controlConnectFunctionsName') ||\r\n !Array.isArray(element.controlConnectFunctionsName) ||\r\n element.controlConnectFunctionsName.indexOf(functionHandler.name) == -1) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i ),\r\n elementKind;\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n elementKind = infArr[1];\r\n }\r\n\r\n// if( ! element.hasOwnProperty( 'сontrolsConnectIndic' ) || element.сontrolsConnectIndic !== true && elementKind ) {\r\n// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n// if( elementsSettingsTemplateJs.length > 0 ) {\r\n// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\r\n//\r\n// let elementsSettings = elementsSettingsTemplateJs.innerHTML;\r\n// let controlClassesNames = [];\r\n// if( elementsSettings ) {\r\n// elementsSettings = elementsSettings.trim();\r\n// elementsSettings = JSON.parse( elementsSettings );\r\n// if( elementsSettings && typeof elementsSettings === 'object' ) {\r\n// if( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] in elementsSettings ) {\r\n// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\r\n// if( elementSettings && typeof elementSettings === 'object' ) {\r\n// Object.keys( elementSettings ).forEach( function( key ) {\r\n// let regularText = new RegExp( 'data-wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\r\n// let keyInfArr = key.match( regularText );\r\n// if( keyInfArr && Array.isArray( keyInfArr ) ) {\r\n// let controlClass = key.replace( 'data-', '' );\r\n// controlClassesNames.push( [controlClass, keyInfArr[2]] );\r\n// }\r\n// });\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n if( elementKind ){\r\n let elementOptionsGroupIds = element.optionsGroupIds;\r\n if(elementOptionsGroupIds && Array.isArray(elementOptionsGroupIds)) {\r\n for(let i = 0; i < elementOptionsGroupIds.length; i++) {\r\n let elementOptionsGroupId = elementOptionsGroupIds[i];\r\n\r\n let elementOptionsGroup = document.getElementById(elementOptionsGroupId);\r\n\r\n let controlActiveElements = elementOptionsGroup.querySelectorAll('.wptb-element-property');\r\n controlActiveElements = [...controlActiveElements];\r\n\r\n controlActiveElements.map(controlActiveElement => {\r\n let regularText = new RegExp( 'wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\r\n let controlInfArr = controlActiveElement.className.match( regularText );\r\n if( controlInfArr && Array.isArray( controlInfArr ) ) {\r\n let controlUnicClassName = controlInfArr[0];\r\n\r\n element.addEventListener( 'wptb-control:' + controlUnicClassName, function(e) {\r\n let controls = {};\r\n let controlName = controlInfArr[2];\r\n let control = document.getElementsByClassName( controlUnicClassName );\r\n if( control.length > 0 && controlName ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\r\n\r\n if(acceptEventValues) {\r\n controls[controlName] = {\r\n targetValue: targetControlValue,\r\n eventValue: e.detail.value\r\n }\r\n }else {\r\n controls[controlName] = targetControlValue;\r\n }\r\n }\r\n functionHandler( controls, element );\r\n }, false );\r\n }\r\n });\r\n }\r\n }\r\n //let elementOptionsContainer = document.querySelector( '.wptb-element-options.wptb-options-' + infArr[1] + '-' + infArr[2] );\r\n\r\n // from time to time depend on table cells hierarchy, cell td items may catch mouse clicks which are intended for elements. since the active section is not cell management, this will gives and unharmfull error of not found element, simple check for null equality will be sufficient for now.\r\n // if(!elementOptionsContainer){\r\n // return;\r\n // }\r\n\r\n // let elementOptions = elementOptionsContainer.querySelectorAll( '.wptb-element-option' );\r\n // let controlActiveElements = elementOptions[i].querySelector( '.wptb-element-property' );\r\n //\r\n //\r\n // for( let i = 0; i < elementOptions.length; i++ ) {\r\n // let controlActiveElement = elementOptions[i].querySelector( '.wptb-element-property' );\r\n // if( controlActiveElement ) {\r\n //\r\n // }\r\n // }\r\n\r\n if(!element.controlConnectFunctionsName && !Array.isArray(element.controlConnectFunctionsName)) {\r\n element.controlConnectFunctionsName = [];\r\n }\r\n\r\n element.controlConnectFunctionsName.push( functionHandler.name );\r\n }\r\n }\r\n }, false );\r\n }\r\n },\r\n oneControlInclude: function( element, functionHandler, controlName ) {\r\n if( element && typeof element === 'object' && typeof functionHandler === 'function' && typeof controlName === 'string' ) {\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i ),\r\n elementKind;\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n elementKind = infArr[1].split( '-' )[0];\r\n\r\n let wptbContrlStacksConfigId = 'wptb-' + elementKind + '-control-stack';\r\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\r\n let data = {\r\n container: '.' + infArr[0]\r\n };\r\n let jsonControlsConfigJson = tmplControlsConfig( data );\r\n let jsonControlsConfig = JSON.parse( jsonControlsConfigJson );\r\n\r\n if( jsonControlsConfig && typeof jsonControlsConfig === 'object' && jsonControlsConfig.hasOwnProperty( controlName ) ) {\r\n let controlClassName = 'wptb-el-' + infArr[1] + '-' + controlName;\r\n\r\n element.addEventListener( 'wptb-control:' + controlClassName, function( event ) {\r\n let control = document.getElementsByClassName( controlClassName );\r\n if( control.length > 0 ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\r\n\r\n functionHandler( targetControlValue, element );\r\n }\r\n }, false );\r\n }\r\n }\r\n } else {\r\n return false;\r\n }\r\n },\r\n //\r\n innerElementCopyIncludeHandler: function( element, functionHandler ) {\r\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\r\n element.addEventListener( 'wptb-inner-element:copy', function( event ) {\r\n let innerElement = event.detail;\r\n if( innerElement ) {\r\n WPTB_Helper.elementClearFromTinyMce( innerElement );\r\n functionHandler( innerElement, element );\r\n }\r\n }, false );\r\n }\r\n },\r\n //\r\n appearDependOnControl: function( dependOn, targetControlElementClass ) {\r\n if( Array.isArray( dependOn ) ) {\r\n let dependOnControlName = dependOn[0];\r\n let infArr = targetControlElementClass.match( /wptb-el-((.+-)\\d+)-(.+)/i );\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let controlName = infArr[3];\r\n\r\n let dependOnControlElementClass = targetControlElementClass.replace( controlName, dependOnControlName );\r\n\r\n let dependOnControlElement = document.getElementsByClassName( dependOnControlElementClass );\r\n\r\n if( dependOnControlElement.length > 0 ) {\r\n dependOnControlElement = dependOnControlElement[0];\r\n let targetControlElement = document.getElementsByClassName( targetControlElementClass );\r\n if( targetControlElement.length > 0 ) {\r\n targetControlElement = targetControlElement[0];\r\n let controlContainerElem = WPTB_Helper.findAncestor( targetControlElement, 'wptb-element-option' );\r\n\r\n if( controlContainerElem ) {\r\n function showHideDependOnControlElement( dependOnControlElementClass, dependOn ) {\r\n\r\n// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n// if( elementsSettingsTemplateJs.length > 0 ) {\r\n// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\r\n//\r\n// let elementsSettings = elementsSettingsTemplateJs.innerHTML;\r\n// if( elementsSettings ) {\r\n// elementsSettings = elementsSettings.trim();\r\n// elementsSettings = JSON.parse( elementsSettings );\r\n// if( elementsSettings && typeof elementsSettings === 'object' &&\r\n// ( 'tmpl-wptb-el-datas-' + dependOnControlElementKind ) in elementsSettings ) {\r\n// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + dependOnControlElementKind];\r\n// if( elementSettings && typeof elementSettings === 'object' &&\r\n// ( 'data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName ) in elementSettings ) {\r\n// let elementSettingValue = elementSettings['data-wptb-el-' + dependOnControlElementKind + '-' + dependOnControlName];\r\n//\r\n// if( elementSettingValue ) {\r\n// if( dependOn[1] && Array.isArray( dependOn[1] ) &&\r\n// ( dependOn[1].indexOf( elementSettingValue ) !== -1 ) ) {\r\n// controlContainerElem.style.display = 'block';\r\n// } else if( dependOn[2] && Array.isArray( dependOn[2] ) &&\r\n// ( dependOn[2].indexOf( elementSettingValue ) !== -1 ) ) {\r\n// controlContainerElem.style.display = 'none';\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n// }\r\n if( dependOnControlElementClass ) {\r\n let dependOnControlElements = document.getElementsByClassName( dependOnControlElementClass );\r\n if( dependOnControlElements.length > 0 ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( dependOnControlElements );\r\n\r\n if( dependOn[1] && Array.isArray( dependOn[1] ) &&\r\n ( dependOn[1].indexOf( targetControlValue ) !== -1 ) ) {\r\n controlContainerElem.style.display = 'block';\r\n let childCheck = controlContainerElem.querySelector('input[type=\"checkbox\"]')\r\n if (childCheck) {\r\n childCheck.checked = true;\r\n }\r\n } else if( dependOn[2] && Array.isArray( dependOn[2] ) &&\r\n ( dependOn[2].indexOf( targetControlValue ) !== -1 ) ) {\r\n controlContainerElem.style.display = 'none';\r\n }\r\n }\r\n }\r\n }\r\n\r\n showHideDependOnControlElement( dependOnControlElementClass, dependOn );\r\n\r\n dependOnControlElement.addEventListener( 'change', function( event ) {\r\n showHideDependOnControlElement( dependOnControlElementClass, dependOn );\r\n }, false );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n controlsStateManager: function ( targetControlClass, controlChangeIndic ) {\r\n let targetControls = document.getElementsByClassName( targetControlClass );\r\n if( targetControls.length > 0 ) {\r\n //targetControls = targetControls[0];\r\n\r\n let infArr = targetControlClass.match( /wptb-el-((.+-)\\d+)-(.+)/i );\r\n\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let selectorElement;\r\n selectorElement = document.querySelector( '.wptb-element-' + infArr[1] );\r\n\r\n if( selectorElement ) {\r\n let elementsSettingsTemplatesJs;\r\n let elementSettings = {};\r\n let elementsSettings;\r\n elementsSettingsTemplatesJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n if( elementsSettingsTemplatesJs.length == 0 || elementsSettingsTemplatesJs[0].innerHTML == '' ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\r\n elementSettings['data-' + targetControlClass] = targetControlValue;\r\n\r\n elementsSettings = {};\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = elementSettings;\r\n elementsSettings = JSON.stringify( elementsSettings );\r\n\r\n if( elementsSettingsTemplatesJs.length == 0 ) {\r\n elementsSettingsTemplatesJs = document.createElement( 'script' );\r\n elementsSettingsTemplatesJs.setAttribute( 'type', 'text/html' );\r\n elementsSettingsTemplatesJs.setAttribute( 'class', 'wptb-element-datas' );\r\n } else {\r\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\r\n }\r\n\r\n elementsSettingsTemplatesJs.innerHTML = elementsSettings;\r\n\r\n let body = document.getElementsByTagName('body')[0];\r\n body.appendChild( elementsSettingsTemplatesJs );\r\n } else {\r\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\r\n elementsSettings = elementsSettingsTemplatesJs.innerHTML;\r\n if( elementsSettings ) {\r\n elementsSettings = elementsSettings.trim();\r\n elementsSettings = JSON.parse( elementsSettings );\r\n\r\n if( elementsSettings && typeof elementsSettings === 'object' ) {\r\n\r\n\r\n if( controlChangeIndic ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\r\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\r\n }\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\r\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\r\n } else if( ! ( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\r\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) ) {\r\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\r\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\r\n }\r\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\r\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\r\n } else if( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\r\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) {\r\n for( let i = 0; i < targetControls.length; i++ ) {\r\n if( targetControls[i].type == 'checkbox' ) {\r\n let targetControlValue;\r\n if( targetControls[i].name ) {\r\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass][targetControls[i].name];\r\n } else {\r\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\r\n }\r\n\r\n if( targetControlValue == 'checked' ) {\r\n targetControls[i].checked = true;\r\n } else if( targetControlValue == 'unchecked' ) {\r\n targetControls[i].checked = false;\r\n }\r\n } else {\r\n targetControls[i].value = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n targetControlValueGet: function( targetControls ) {\r\n let targetControlValue;\r\n for( let i = 0; i < targetControls.length; i++ ) {\r\n if( targetControls[i].type == 'checkbox' && targetControls[i].name ) {\r\n if( ! targetControlValue ) targetControlValue = {};\r\n if( targetControls[i].checked == true ) {\r\n targetControlValue[targetControls[i].name] = 'checked';\r\n } else {\r\n targetControlValue[targetControls[i].name] = 'unchecked';\r\n }\r\n } else if( targetControls[i].type == 'checkbox' ) {\r\n if( targetControls[i].checked == true ) {\r\n targetControlValue = 'checked';\r\n } else {\r\n targetControlValue = 'unchecked';\r\n }\r\n } else if( targetControls[i].type ) {\r\n targetControlValue = targetControls[i].value;\r\n } else if( targetControls[i].dataset.alignmentValue && targetControls[i].classList.contains( 'selected' ) ){\r\n targetControlValue = targetControls[i].dataset.alignmentValue;\r\n }\r\n }\r\n return targetControlValue;\r\n },\r\n //\r\n elementControlsStateCopy: function( elementProt, copyElem ) {\r\n if( elementProt && copyElem ) {\r\n let infArrProt = elementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n let infArrCopy = copyElem.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( infArrProt && Array.isArray( infArrProt ) &&\r\n infArrCopy && Array.isArray( infArrCopy )) {\r\n let elemProtKind = infArrProt[1];\r\n let elemCopyKind = infArrCopy[1];\r\n let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\r\n if( elementsSettingsTemplateJs.length > 0 ) {\r\n elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\r\n\r\n let elementsSettings = elementsSettingsTemplateJs.innerHTML;\r\n if( elementsSettings ) {\r\n elementsSettings = elementsSettings.trim();\r\n elementsSettings = JSON.parse( elementsSettings );\r\n\r\n if( elementsSettings && typeof elementsSettings === 'object' ) {\r\n let elementSettingsProt = elementsSettings['tmpl-wptb-el-datas-' + elemProtKind];\r\n if( elementSettingsProt && typeof elementSettingsProt === 'object' ) {\r\n let elementSettingsCopy = {};\r\n\r\n Object.keys( elementSettingsProt ).forEach( function( key ) {\r\n let elementSettingValue = elementSettingsProt[key];\r\n let elementSettingKeyCopy = key.replace( elemProtKind, elemCopyKind );\r\n elementSettingsCopy[elementSettingKeyCopy] = elementSettingValue;\r\n });\r\n\r\n if( Object.keys( elementSettingsCopy ).length > 0 ) {\r\n elementsSettings['tmpl-wptb-el-datas-' + elemCopyKind] = elementSettingsCopy;\r\n\r\n elementsSettings = JSON.stringify( elementsSettings );\r\n elementsSettingsTemplateJs.innerHTML = elementsSettings;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n elementControlsStateDelete: function( element, nameControl ) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n let body = document.getElementsByTagName( 'body' )[0];\r\n let wptbElementDatas = body.getElementsByClassName( 'wptb-element-datas' );\r\n if( infArr && Array.isArray( infArr ) && wptbElementDatas.length > 0 ) {\r\n wptbElementDatas = wptbElementDatas[0];\r\n let elementsSettings = wptbElementDatas.innerHTML;\r\n if( elementsSettings ) {\r\n elementsSettings = elementsSettings.trim();\r\n elementsSettings = JSON.parse( elementsSettings );\r\n if( elementsSettings && typeof elementsSettings === 'object' &&\r\n ( ( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] ) in elementsSettings ) ) {\r\n if( ! nameControl ) {\r\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\r\n } else {\r\n if( elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] &&\r\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] === 'object' &&\r\n ( 'data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] ) {\r\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]]['data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl];\r\n }\r\n }\r\n\r\n if( Object.keys( elementsSettings ).length == 0 ) {\r\n body.removeChild( wptbElementDatas );\r\n } else {\r\n elementsSettings = JSON.stringify( elementsSettings );\r\n wptbElementDatas.innerHTML = elementsSettings;\r\n }\r\n }\r\n }\r\n }\r\n },\r\n //\r\n elementOptionsSet: function( kind, element ) {\r\n // get controls config for this element\r\n let wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';\r\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\r\n let data;\r\n let elementContainerClass;\r\n let elementOptionClassIndic;\r\n let elementOptionsGroup;\r\n\r\n let controlElementParent;\r\n let elementOptionsScriptsContainer;\r\n\r\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( ! infArr ) {\r\n let table_id = WPTB_Helper.detectMode();\r\n if (!table_id) {\r\n table_id = 'startedid-0';\r\n }\r\n if( element.classList.contains( 'wptb-preview-table' ) ) {\r\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\r\n } else if( element.classList.contains( 'wptb-cell' ) ) {\r\n let cellEditActiveClass = document.querySelector('.wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\r\n if( ! cellEditActiveClass ) element.classList.add('wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\r\n }else if (element.classList.contains('wptb-responsive')){\r\n element.classList.add('wptb-element-table_responsive_setting-' + table_id);\r\n }\r\n\r\n infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\r\n }\r\n\r\n data = {\r\n container: '.' + infArr[0]\r\n };\r\n\r\n elementContainerClass = infArr[0];\r\n elementOptionClassIndic = infArr[1];\r\n\r\n if( element.classList.contains( 'wptb-preview-table' ) ) {\r\n\r\n } else if( element.classList.contains( 'wptb-cell' ) ) {\r\n this.activateSection('cell_settings');\r\n }else if (element.classList.contains('wptb-responsive')){\r\n elementOptionsGroupId = 'table-responsive-group';\r\n wptbelementOptionClass = 'wptb-element-option';\r\n }\r\n else {\r\n let children = document.getElementById( 'element-options-group' ).childNodes;\r\n for ( let i = 0; i < children.length; i++) {\r\n if ( children[i].style )\r\n children[i].style.display = 'none';\r\n }\r\n\r\n // hide wptb-elements-container and wptb-settings-section\r\n // document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'none';\r\n // document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'none';\r\n\r\n // show element-options-group\r\n // document.getElementById( 'element-options-group' ).style.display = 'block';\r\n this.activateSection('options_group');\r\n }\r\n\r\n let jsonControlsConfigJson = tmplControlsConfig( data );\r\n let jsonControlsConfig = JSON.parse( jsonControlsConfigJson );\r\n\r\n let elementOptionsGroupIdsInvolved = [],\r\n elementOptionsGroupInvolved = {},\r\n elementOptionsContainerInvolved = {};\r\n\r\n // object for save all scrips for each controls\r\n let controlScriptsObj = {};\r\n\r\n // array for keep \"appear depend on\" parametrs\r\n let controlappearDependOnControl = [];\r\n\r\n // create controls\r\n let elementOptionsScriptsContainerIndic = false;\r\n let i = 0;\r\n Object.keys( jsonControlsConfig ).forEach( function( key ) {\r\n let data = jsonControlsConfig[key];\r\n data.controlKey = key;\r\n\r\n // get necessary wp js template\r\n let tmplControlTemplate = wp.template( 'wptb-' + data.type + '-control' );\r\n\r\n data.elemContainer = elementContainerClass;\r\n data.elementControlTargetUnicClass = 'wptb-el-' + elementOptionClassIndic + '-' + data.controlKey;\r\n let controlTemplate = tmplControlTemplate( data );\r\n if( 'appearDependOnControl' in data ) {\r\n if( Array.isArray( data.appearDependOnControl ) ) {\r\n controlappearDependOnControl.push( [data.appearDependOnControl, data.elementControlTargetUnicClass] );\r\n }\r\n }\r\n\r\n function elementOptionsContainerInvolvedGet(elementOptionsGroupId, elementOptionsContainerInvolved) {\r\n if(!elementOptionsContainerInvolved[elementOptionsGroupId]){\r\n let elementOptionsContainer = document.createElement( 'div' );\r\n elementOptionsContainer.classList.add( 'wptb-element-options', 'wptb-options-' + infArr[1] );\r\n document.getElementById( elementOptionsGroupId ).appendChild(elementOptionsContainer);\r\n elementOptionsContainerInvolved[elementOptionsGroupId] = elementOptionsContainer;\r\n }\r\n\r\n return elementOptionsContainerInvolved[elementOptionsGroupId];\r\n }\r\n\r\n if(elementOptionsGroupIdsInvolved.indexOf(data.elementOptionsGroupId) == -1) {\r\n elementOptionsGroupIdsInvolved.push(data.elementOptionsGroupId);\r\n // clear elements from options group\r\n //document.getElementById( 'element-options-group' ).innerHTML = '';\r\n elementOptionsGroup = document.getElementById(data.elementOptionsGroupId);\r\n let elementOptionsGroupChildren = [...elementOptionsGroup.children];\r\n for( let i = 0; i < elementOptionsGroupChildren.length; i++ ) {\r\n elementOptionsGroup.removeChild( elementOptionsGroupChildren[i] );\r\n }\r\n elementOptionsGroupInvolved[data.elementOptionsGroupId] = elementOptionsGroup;\r\n }\r\n\r\n controlElementParent = elementOptionsGroupInvolved[data.elementOptionsGroupId];\r\n\r\n if(data.elementOptionsContainerOn === 'true') {\r\n controlElementParent = elementOptionsContainerInvolvedGet(data.elementOptionsGroupId, elementOptionsContainerInvolved);\r\n }\r\n\r\n\r\n if(data.elementOptionContainerOn === 'true') {\r\n let elementOptionContainer = document.createElement( 'div' );\r\n elementOptionContainer.classList.add( data.elementOptionClass, 'wptb-settings-items' );\r\n\r\n if( data.customClassForContainer ) {\r\n elementOptionContainer.classList.add( data.customClassForContainer );\r\n }\r\n\r\n if( data.containerAdditionalStyles ) {\r\n elementOptionContainer.setAttribute( 'style', data.containerAdditionalStyles );\r\n }\r\n\r\n controlElementParent.appendChild( elementOptionContainer );\r\n\r\n controlElementParent = elementOptionContainer;\r\n }\r\n controlElementParent.innerHTML = controlElementParent.innerHTML + controlTemplate;\r\n\r\n let helperJavascriptElem = controlElementParent.getElementsByTagName( 'wptb-template-script' );\r\n if( helperJavascriptElem.length > 0 ) {\r\n helperJavascriptElem = helperJavascriptElem[0];\r\n let helperJavascriptCode = helperJavascriptElem.innerText;\r\n controlElementParent.removeChild( helperJavascriptElem );\r\n let script = document.createElement( 'script' );\r\n script.setAttribute( 'type', 'text/javascript' );\r\n script.innerHTML = helperJavascriptCode.replace(/\\r|\\n|\\t/g, '').trim();\r\n if(!controlScriptsObj[data.elementOptionsGroupId] || !Array.isArray(controlScriptsObj[data.elementOptionsGroupId])) {\r\n controlScriptsObj[data.elementOptionsGroupId] = [];\r\n }\r\n controlScriptsObj[data.elementOptionsGroupId].push( script );\r\n }\r\n\r\n i++;\r\n });\r\n\r\n element.optionsGroupIds = elementOptionsGroupIdsInvolved;\r\n\r\n Object.keys( controlScriptsObj ).forEach( function( elementOptionsGroupId ) {\r\n let controlScriptsArr = controlScriptsObj[elementOptionsGroupId];\r\n elementOptionsScriptsContainer = document.createElement( 'div' );\r\n elementOptionsScriptsContainer.classList.add( 'wptb-element-options-scripts', 'wptb-options-' + infArr[1] );\r\n elementOptionsGroupInvolved[elementOptionsGroupId].appendChild(elementOptionsScriptsContainer);\r\n if( controlScriptsArr.length > 0 ) {\r\n for( let i = 0; i < controlScriptsArr.length; i++ ) {\r\n elementOptionsScriptsContainer.appendChild(controlScriptsArr[i]);\r\n }\r\n }\r\n });\r\n\r\n\r\n\r\n // run the scripts of controls\r\n\r\n\r\n // run appearDependOnControl function\r\n for ( let i = 0; i < controlappearDependOnControl.length; i++ ) {\r\n WPTB_Helper.appearDependOnControl( controlappearDependOnControl[i][0], controlappearDependOnControl[i][1] );\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate( 'element:controls:active', element );\r\n },\r\n\r\n /**\r\n * function for create, update css for element\r\n *\r\n * @param elementContainer\r\n * @param selector\r\n * @param cssName\r\n * @param cssValue\r\n */\r\n managerExternalCssStyles: function( elementContainer, selector, cssName, cssValue ) {\r\n let infArr = elementContainer.match( /wptb-element-main(.+)-(\\d+)/i );\r\n if( ! infArr || ! Array.isArray( infArr ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n if( table.length > 0 ) {\r\n table = table[0];\r\n\r\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n selector = '.' + infArr[0] + ' ' + selector;\r\n }\r\n }\r\n }\r\n\r\n let head = document.head;\r\n if( head ) {\r\n let cssForThisElement = head.querySelector( '#styles-' + elementContainer );\r\n if( cssForThisElement ) {\r\n let cssText = cssForThisElement.innerHTML;\r\n if( cssText ) {\r\n let cssTextArrFirst = cssText.split( '}' );\r\n cssTextArrFirst.pop();\r\n let selectorExists = false;\r\n for( let i = 0; i < cssTextArrFirst.length; i++ ) {\r\n let cssTextArrSecond = cssTextArrFirst[i].split( '{' );\r\n if( cssTextArrSecond[0] === selector ) {\r\n let cssTextArrThird = cssTextArrSecond[1].split( ';' );\r\n cssTextArrThird.pop();\r\n let cssNameExists = false;\r\n for( let j = 0; j < cssTextArrThird.length; j++ ) {\r\n let cssTextArrFourth = cssTextArrThird[j].split( ':' );\r\n if( cssTextArrFourth[0] === cssName ) {\r\n if( cssValue ) {\r\n cssTextArrThird[j] = cssName + ':' + cssValue;\r\n } else {\r\n cssTextArrThird.splice( j, 1 );\r\n }\r\n\r\n cssTextArrSecond[1] = cssTextArrThird.join( ';' ) ? cssTextArrThird.join( ';' ) + ';' : '';\r\n cssNameExists = true;\r\n break;\r\n }\r\n }\r\n if( ! cssNameExists ) {\r\n if( cssValue ) {\r\n cssTextArrSecond[1] += cssName + ':' + cssValue + ';';\r\n }\r\n }\r\n if( cssTextArrSecond[1] ) {\r\n cssTextArrFirst[i] = cssTextArrSecond[0] + '{' + cssTextArrSecond[1]\r\n } else {\r\n cssTextArrFirst.splice( i, 1 );\r\n }\r\n if( cssTextArrFirst.join( '}' ) ) {\r\n cssForThisElement.innerHTML = cssTextArrFirst.join( '}' ) + '}';\r\n } else {\r\n head.removeChild( cssForThisElement );\r\n }\r\n\r\n selectorExists = true;\r\n break;\r\n }\r\n }\r\n\r\n if( ! selectorExists ) {\r\n if( cssValue ) {\r\n cssForThisElement.innerHTML = cssText + selector + '{' + cssName + ':' + cssValue + ';}';\r\n } else {\r\n cssForThisElement.innerHTML = cssText;\r\n }\r\n }\r\n } else {\r\n if( cssValue ) {\r\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\r\n } else {\r\n head.removeChild( cssForThisElement );\r\n }\r\n }\r\n } else {\r\n if( cssValue ) {\r\n let cssForThisElement = document.createElement( 'style' );\r\n cssForThisElement.setAttribute( 'id', 'styles-' + elementContainer );\r\n cssForThisElement.classList.add( 'styles-wptb-elements' );\r\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\r\n head.appendChild( cssForThisElement );\r\n }\r\n }\r\n }\r\n },\r\n /**\r\n *\r\n * Register section parts for sidebar\r\n *\r\n * @param {array} sections an array of section names\r\n */\r\n registerSections(sections) {\r\n this.sections = {};\r\n this.currentSection = '';\r\n if (!Array.isArray(sections)) {\r\n sections = [sections];\r\n }\r\n\r\n sections.map(s => {\r\n const sectionElement = document.querySelector(`[data-wptb-section=${s}]`);\r\n if (sectionElement) {\r\n this.sections[s] = sectionElement;\r\n }\r\n })\r\n },\r\n /**\r\n * Activate a registered section and deactivates others\r\n *\r\n * @param {string} sectionDataId section name to be activated\r\n * @param {string} displayType display type override for section to be used in its display style property\r\n */\r\n activateSection(sectionDataId, displayType = 'block') {\r\n this.currentSection=sectionDataId;\r\n this.triggerSectionEvent(sectionDataId);\r\n Object.keys(this.sections).map(k => {\r\n if (Object.prototype.hasOwnProperty.call(this.sections, k)) {\r\n const visibility = sectionDataId === k ? displayType : 'none';\r\n this.sections[k].style = `display: ${visibility} !important`;\r\n }\r\n })\r\n },\r\n /**\r\n * Get id of current active section\r\n *\r\n * @returns {string} active section i\r\n */\r\n getCurrentSection(){\r\n return this.currentSection;\r\n },\r\n /**\r\n * Get current section from search parameter 'wptb-builder-section' of window location\r\n */\r\n getSectionFromUrl(){\r\n const parsedUrl = new URL(window.location.href);\r\n const urlSection = parsedUrl.searchParams.get('wptb-builder-section');\r\n if(urlSection){\r\n if(Object.keys(this.sections).some(key => key===urlSection)){\r\n this.activateSection(urlSection);\r\n }\r\n }\r\n },\r\n /**\r\n * Set up related buttons and links to trigger certain elements\r\n */\r\n setupSectionButtons() {\r\n const sectionButtons = Array.from( document.querySelectorAll('[data-wptb-section-button'));\r\n const vm = this;\r\n\r\n sectionButtons.map(s => {\r\n const sectionName = s.dataset.wptbSectionButton;\r\n s.addEventListener('click', function() {\r\n const displayType = s.dataset.wptbSectionDisplayType;\r\n vm.activateSection(sectionName, displayType);\r\n })\r\n\r\n document.addEventListener('wptbSectionChanged', (e)=> {\r\n if(e.detail === sectionName){\r\n s.classList.remove('disabled');\r\n s.classList.add('active');\r\n }else{\r\n s.classList.remove('active');\r\n s.classList.add('disabled');\r\n }\r\n })\r\n })\r\n },\r\n setupPanelToggleButtons(){\r\n const $ = jQuery;\r\n\r\n $('.wptb-panel-toggle-group').each(function(){\r\n const vm = $(this);\r\n $(this).find('.toggle-icon').click(() => {\r\n vm.find('.wptb-panel-toggle-target').slideToggle();\r\n vm.toggleClass('wptb-panel-toggle-content');\r\n })\r\n })\r\n },\r\n /**\r\n * Trigger a section change event\r\n *\r\n * @param {string} sectionName section name\r\n */\r\n triggerSectionEvent(sectionName){\r\n const sectionEvent = new CustomEvent('wptbSectionChanged', {detail: sectionName});\r\n\r\n document.dispatchEvent(sectionEvent);\r\n },\r\n /**\r\n * Setup sidebar toggle element\r\n *\r\n * @param {string} toggleSelector query selector for drawer toggle element\r\n */\r\n setupSidebarToggle(toggleSelector){\r\n const toggleButton = document.querySelector(toggleSelector);\r\n if(toggleButton){\r\n toggleButton.addEventListener('click', (e)=>{\r\n e.preventDefault();\r\n document.body.classList.toggle('collapsed');\r\n })\r\n }\r\n },\r\n // function for deleting all external CSS for the element\r\n externalCssStylesDelete: function( elementContainerClass ) {\r\n let head = document.head;\r\n if( head ) {\r\n let cssForThisElement = head.querySelector( '#styles-' + elementContainerClass );\r\n\r\n if( cssForThisElement ) {\r\n head.removeChild( cssForThisElement );\r\n }\r\n }\r\n },\r\n // function for copy all external CSS for the element\r\n externalCssStylesCopy: function( activeElement, copyElement ) {\r\n if( activeElement ) {\r\n let infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let activeElemClass = infArr[0];\r\n\r\n let head = document.head;\r\n if( head ) {\r\n let cssForActiveElement = head.querySelector( '#styles-' + activeElemClass );\r\n\r\n if( cssForActiveElement ) {\r\n let cssForNewElement = cssForActiveElement.cloneNode( true );\r\n\r\n cssForNewElement.removeAttribute( 'id', 'styles-' + activeElemClass );\r\n\r\n let infArrCopyEl = copyElement.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArrCopyEl && Array.isArray( infArrCopyEl ) ) {\r\n cssForNewElement.setAttribute( 'id', 'styles-' + infArrCopyEl[0] );\r\n let cssForActiveElementInnerHTML = cssForActiveElement.innerHTML;\r\n let cssForNewElementInnerHTML = WPTB_Helper.replaceAll( cssForActiveElementInnerHTML, activeElemClass, infArrCopyEl[0] );\r\n cssForNewElement.innerHTML = cssForNewElementInnerHTML;\r\n head.appendChild( cssForNewElement );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n // function for convertation elements stiles in json\r\n elementsStylesConvertToObject: function() {\r\n let head = document.head;\r\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\r\n let stylesObj = {};\r\n for( let i = 0; i < stylesElements.length; i++ ) {\r\n let styleElemId = stylesElements[i].getAttribute( 'id' );\r\n if( styleElemId && stylesElements[i].innerHTML ) {\r\n stylesObj[styleElemId] = stylesElements[i].innerHTML;\r\n }\r\n }\r\n\r\n if( Object.keys( stylesObj ).length != 0 ) {\r\n return JSON.stringify( stylesObj );\r\n }\r\n return '';\r\n },\r\n // function for set scc styles tags to head\r\n elementsStylesSetFromObject: function( jsonObject ) {\r\n let head = document.head;\r\n if( head ) {\r\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\r\n if( stylesElements.length > 0 ) {\r\n stylesElements = [...stylesElements];\r\n for( let i = 0; i < stylesElements.length; i++ ) {\r\n head.removeChild( stylesElements[i] );\r\n }\r\n }\r\n if( jsonObject ) {\r\n let stylesObj = JSON.parse( jsonObject );\r\n if( Object.keys( stylesObj ).length != 0 ) {\r\n Object.keys( stylesObj ).forEach( function( key ) {\r\n let cssText = stylesObj[key];\r\n let styleCss = document.createElement( 'style' );\r\n styleCss.setAttribute( 'id', key );\r\n styleCss.classList.add( 'styles-wptb-elements' );\r\n styleCss.innerHTML = cssText;\r\n head.appendChild( styleCss );\r\n });\r\n }\r\n }\r\n }\r\n },\r\n // function for table saving\r\n saveTable: function( event, startSaving, previewSaving ) {\r\n if( ! previewSaving && ! startSaving ) {\r\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) ||\r\n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\r\n //return;\r\n }\r\n }\r\n\r\n if( ! previewSaving ) {\r\n let bar = document.querySelector( '.wptb-edit-bar' );\r\n if ( bar && bar.classList.contains( 'visible' ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\r\n WPTB_Helper.toggleTableEditMode();\r\n }\r\n }\r\n\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\r\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\r\n messagingArea,\r\n code,\r\n datas;\r\n\r\n code = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n let postId;\r\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\r\n postId = rs;\r\n }\r\n let paramIdsNecessaryChange = false;\r\n if( code.length > 0 ) {\r\n code = code[0];\r\n let codeClone = code.cloneNode( true );\r\n if( postId ) {\r\n if( codeClone.classList.contains( 'wptb-element-main-table_setting-startedid-0' ) ) {\r\n codeClone.classList.remove( 'wptb-element-main-table_setting-startedid-0' );\r\n codeClone.classList.add( 'wptb-element-main-table_setting-' + postId );\r\n let wptbTableSetup = document.querySelector('.wptb-table-setup');\r\n if(wptbTableSetup) {\r\n wptbTableSetup.innerHTML = '';\r\n wptbTableSetup.appendChild(codeClone);\r\n WPTB_Table();\r\n }\r\n paramIdsNecessaryChange = true;\r\n }\r\n }\r\n codeClone.columns = code.columns;\r\n code = WPTB_Stringifier( codeClone );\r\n code = code.outerHTML;\r\n } else {\r\n code = '';\r\n }\r\n\r\n if( ! previewSaving ) {\r\n datas = '';\r\n let datas_containers = document.getElementsByClassName( 'wptb-element-datas' );\r\n\r\n if( datas_containers.length > 0 ) {\r\n if( datas_containers[0].innerHTML ) {\r\n datas = datas_containers[0].innerHTML;\r\n\r\n if( paramIdsNecessaryChange ) {\r\n datas = WPTB_Helper.replaceAll( datas, 'tmpl-wptb-el-datas-main-table_setting-startedid-0',\r\n 'tmpl-wptb-el-datas-main-table_setting-' + postId );\r\n\r\n datas = WPTB_Helper.replaceAll( datas, 'data-wptb-el-main-table_setting-startedid-0',\r\n 'data-wptb-el-main-table_setting-' + postId );\r\n }\r\n }\r\n }\r\n }\r\n\r\n let styleObjJson = WPTB_Helper.elementsStylesConvertToObject();\r\n if( paramIdsNecessaryChange ) {\r\n styleObjJson = WPTB_Helper.replaceAll( styleObjJson, '.wptb-element-main-table_setting-startedid-0',\r\n '.wptb-element-main-table_setting-' + postId );\r\n }\r\n\r\n if ( t === '' && code === '' ) {\r\n let messagingAreaText = '';\r\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\r\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\r\n messagingArea.classList.add( 'wptb-warning' );\r\n setTimeout(function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n return;\r\n }\r\n\r\n let params = {\r\n title: t,\r\n content: code,\r\n elements_datas: datas,\r\n elements_styles: styleObjJson,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n\r\n\r\n if( previewSaving ) {\r\n params.preview_saving = previewSaving;\r\n }\r\n\r\n if ( postId ) {\r\n params.id = postId;\r\n }\r\n params = JSON.stringify( params );\r\n\r\n http.open('POST', url, true);\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function ( action ) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n\r\n if ( data[0] == 'saved' ) {\r\n let builderPageUrl = document.location.href.replace( '#', '' );\r\n let regex = new RegExp( '&table=(.+)', \"i\" );\r\n builderPageUrl = builderPageUrl.replace( regex, '' );\r\n window.history.pushState( null, null, builderPageUrl + '&table=' + data[1] );\r\n\r\n WPTB_Helper.saveTable( event, true );\r\n return;\r\n } else if( data[0] == 'edited' && startSaving ) {\r\n document.wptbId = data[1];\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\r\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\r\n let wptbPreviewTable = document.querySelector( '.wptb-preview-table' );\r\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\r\n if( wptbPreviewBtn.length > 0 ) {\r\n wptbPreviewBtn = wptbPreviewBtn[0];\r\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\r\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\r\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\r\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\r\n }\r\n\r\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else if( data[0] == 'edited' ) {\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\r\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else if( data[0] == 'preview_edited' ) {\r\n return;\r\n } else {\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\r\n }\r\n messagingArea.classList.add( 'wptb-success' );\r\n setTimeout( function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n }\r\n }\r\n http.send( params );\r\n },\r\n //\r\n clickOnFreeSpace: function() {\r\n // if current active section is responsive menu, ignore this functionality\r\n if(this.getCurrentSection() === 'table_responsive_menu'){\r\n return;\r\n }\r\n\r\n let cellModeBackground = document.querySelector( '#wptb-cell_mode_background' );\r\n if( cellModeBackground && cellModeBackground.classList.contains( 'visible' ) ) {\r\n return;\r\n }\r\n // document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\r\n // document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\r\n // document.getElementById( 'element-options-group' ).style.display = 'none';\r\n this.activateSection('elements');\r\n\r\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\r\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\r\n }\r\n let element = document.querySelector( '.wptb-preview-table' );\r\n if( element ) {\r\n WPTB_Helper.elementOptionsSet( 'table_setting', element );\r\n }\r\n },\r\n\r\n /*\r\n * function for sending of element ajax request\r\n */\r\n elementAjax: function( dataAjaxData, element ) {\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=wptb_element_ajax\";\r\n let element_name;\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n element_name = infArr[1];\r\n }\r\n\r\n let params = {\r\n element_ajax_data: dataAjaxData,\r\n element_name: element_name,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n params = JSON.stringify( params );\r\n\r\n http.open( 'POST', url, true );\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function ( action ) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n let detail;\r\n if ( data && Array.isArray( data ) && data[0] == 'element_ajax_responce' ) {\r\n detail = {value: data[1]};\r\n } else {\r\n detail = '';\r\n }\r\n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-element:ajax-response', element, detail );\r\n }\r\n }\r\n http.send( params );\r\n },\r\n\r\n /*\r\n * This just toggles visibility of cell edit bar, and toggles\r\n * cell selecting mode.\r\n */\r\n toggleTableEditMode: function ( close = false ) {\r\n let bar = document.getElementsByClassName('wptb-edit-bar'),\r\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\r\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\r\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if (wptbPreviewTable.length > 0) {\r\n wptbPreviewTable = wptbPreviewTable[0];\r\n }\r\n\r\n if ( bar.length > 0 ) {\r\n let toggleEditMode = '';\r\n for ( let i = 0; i < bar.length; i++ ) {\r\n if ( bar[i].classList.contains( 'visible' ) ) {\r\n document.select.deactivateMultipleSelectMode();\r\n bar[i].classList.remove( 'visible' );\r\n cellModeBackground.classList.remove( 'visible' );\r\n leftScrollPanelCurtain.classList.remove( 'visible' );\r\n leftScrollPanelCellSettings.classList.remove( 'visible' );\r\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\r\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\r\n if ( wptbPreviewTableTds.length > 0 ) {\r\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\r\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n }\r\n toggleEditMode = 'closed';\r\n\r\n } else if( ! close ) {\r\n document.select.activateMultipleSelectMode();\r\n bar[i].classList.add( 'visible' );\r\n cellModeBackground.classList.add( 'visible' );\r\n leftScrollPanelCurtain.classList.add( 'visible' );\r\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\r\n\r\n toggleEditMode = 'opened';\r\n }\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-edit-mode/' + toggleEditMode, wptbPreviewTable)\r\n }\r\n },\r\n\r\n /*\r\n * checking of dimension of value\r\n */\r\n checkingDimensionValue: function ( value, dimension ) {\r\n value = String( value );\r\n dimension = String( dimension );\r\n if( value && dimension ) {\r\n let searchIndex = value.indexOf( dimension );\r\n if ( searchIndex != -1 && searchIndex == ( value.length - dimension.length ) ) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n } else {\r\n return false;\r\n }\r\n },\r\n\r\n /*\r\n * if dimension is included - checking and if it necessary setting value\r\n * without dimension - return value\r\n */\r\n checkSetGetStyleSizeValue: function( element, styleName, computedStyleName, dimension ) {\r\n let elemStyleValue = element.style[styleName];\r\n elemStyleValue = String( elemStyleValue );\r\n\r\n if( ! elemStyleValue || dimension ? ! ( WPTB_Helper.checkingDimensionValue( elemStyleValue, dimension ) ) : false ){\r\n let elementStyles = window.getComputedStyle( element );\r\n if( computedStyleName && elementStyles.getPropertyValue( computedStyleName ) && dimension ? WPTB_Helper.checkingDimensionValue( elementStyles.getPropertyValue( computedStyleName ), dimension ) : true ) {\r\n if( ! dimension ) {\r\n return elementStyles.getPropertyValue( computedStyleName );\r\n } else {\r\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\r\n }\r\n } else {\r\n if( ! dimension ) {\r\n return false;\r\n } else {\r\n element.style[styleName] = null;\r\n }\r\n }\r\n } else if( ! dimension ) {\r\n return elemStyleValue;\r\n }\r\n\r\n return element.style[styleName];\r\n },\r\n\r\n /*\r\n * function checking that element has the style\r\n * if this style is present - checking the format color\r\n * if param set is true - setting style for element (consider hex format of color)\r\n * if param set is false - getting style from element\r\n */\r\n checkSetGetStyleColorValue: function ( element, styleName, computedStyleName, set = false ) {\r\n let elemStyleColorValue = element.style[styleName];\r\n\r\n if( ! elemStyleColorValue ) {\r\n let elementStyles = window.getComputedStyle( element, null );\r\n\r\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\r\n\r\n if( set ) {\r\n elemStyleColorValue = WPTB_Helper.rgbToHex( elementStyles.getPropertyValue( computedStyleName ) );\r\n if( WPTB_Helper.isHex( elemStyleColorValue ) ) {\r\n element.style[styleName] = elemStyleColorValue;\r\n } else {\r\n element.style[styleName] = '';\r\n }\r\n } else {\r\n return elementStyles.getPropertyValue( computedStyleName );\r\n }\r\n\r\n } else {\r\n if( set ) {\r\n element.style[styleName] = '';\r\n } else {\r\n return '';\r\n }\r\n }\r\n } else if( ! set ) {\r\n return elemStyleColorValue;\r\n }\r\n },\r\n\r\n /*\r\n * function checking that element has the style\r\n * if this style is present - checking the format color\r\n * if param set is true - setting style for element (consider hex format of color)\r\n * if param set is false - getting style from element\r\n */\r\n checkSetGetStyleValue: function ( element, styleName, computedStyleName, set = false ) {\r\n let elemStyleColorValue = element.style[styleName];\r\n\r\n if( ! elemStyleColorValue ) {\r\n let elementStyles = window.getComputedStyle( element, null );\r\n\r\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\r\n\r\n if( set ) {\r\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\r\n } else {\r\n return elementStyles.getPropertyValue( computedStyleName );\r\n }\r\n\r\n } else if( ! set ) {\r\n return '';\r\n }\r\n } else if( ! set ) {\r\n return elemStyleColorValue;\r\n }\r\n },\r\n\r\n /*\r\n * get the value of the same elements that have the most count\r\n */\r\n getValueMaxCountSameElementsInArray: function ( arr ) {\r\n if( arr && Array.isArray( arr ) ) {\r\n let check = {};\r\n for( let i = 0; i < arr.length; i++ ) {\r\n if( check[arr[i]] ) {\r\n check[arr[i]]++;\r\n } else {\r\n check[arr[i]] = 1;\r\n }\r\n }\r\n\r\n let maxPropName;\r\n for ( let key in check ) {\r\n if( ! maxPropName ) {\r\n maxPropName = key;\r\n continue;\r\n } else {\r\n if( check[maxPropName] < check[key] ) {\r\n maxPropName = key;\r\n }\r\n }\r\n }\r\n\r\n return maxPropName;\r\n }\r\n },\r\n\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table.\r\n */\r\n recalculateIndexes: function ( table ) {\r\n let trs = table.getElementsByTagName( 'tr' ),\r\n tds, maxCols = 0, maxColsFull = 0, tdsArr = [];\r\n\r\n for ( let i = 0; i < trs.length; i++ ) {\r\n tds = trs[i].getElementsByTagName( 'td' );\r\n\r\n if ( tdsArr[i] == undefined ) {\r\n tdsArr[i] = [];\r\n }\r\n\r\n let jMainIter = 0;\r\n for ( let j = 0; j < tds.length; j++ ) {\r\n if ( tdsArr[i][j] != undefined ) {\r\n for ( let y = 0; y < 100; y++ ) {\r\n if ( tdsArr[i][jMainIter] != undefined ) {\r\n jMainIter++;\r\n continue;\r\n }\r\n tdsArr[i][jMainIter] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n break;\r\n }\r\n } else {\r\n tdsArr[i][j] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n }\r\n tds[j].dataset.yIndex = i;\r\n\r\n if ( tds[j].colSpan > 1 ) {\r\n for ( let k = 1; k < tds[j].colSpan; k++ ) {\r\n jMainIter++;\r\n tdsArr[i][jMainIter] = 'tdDummy';\r\n }\r\n }\r\n\r\n if ( tds[j].rowSpan > 1 ) {\r\n for ( let x = 1; x < tds[j].rowSpan; x++ ) {\r\n if ( tdsArr[i + x] == undefined ) {\r\n tdsArr[i + x] = [];\r\n }\r\n for ( let z = 0; z < tds[j].colSpan; z++ ) {\r\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\r\n }\r\n }\r\n }\r\n jMainIter++;\r\n\r\n if ( j > maxCols ) {\r\n maxCols = j;\r\n }\r\n }\r\n\r\n if( i == 0 ) {\r\n maxColsFull = jMainIter;\r\n }\r\n }\r\n table.columns = maxCols;\r\n table.maxCols = maxColsFull;\r\n },\r\n\r\n /**\r\n * Table Rows colors reinstall\r\n */\r\n tableRowsColorsReinstall: function ( table ) {\r\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\r\n if( infArr && Array.isArray( infArr ) ) {\r\n let tableIndex = '';\r\n if( infArr[infArr.length -1] == '0' ) {\r\n tableIndex = 'startedid-0';\r\n } else {\r\n tableIndex = infArr[infArr.length -1];\r\n }\r\n\r\n let tableHeaderBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableHeaderBackground' );\r\n if( tableHeaderBackground ) {\r\n let details = {value: tableHeaderBackground.value};\r\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableHeaderBackground, details );\r\n }\r\n\r\n let tableEvenRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableEvenRowBackground' );\r\n if( tableEvenRowBackground ) {\r\n let details = {value: tableEvenRowBackground.value};\r\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableEvenRowBackground, details );\r\n }\r\n\r\n let tableOddRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableOddRowBackground' );\r\n if( tableOddRowBackground ) {\r\n let details = {value: tableOddRowBackground.value};\r\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableOddRowBackground, details );\r\n }\r\n }\r\n },\r\n /**\r\n * Get parent html element of given type\r\n *\r\n * @param {string} parentType type of parent element\r\n * @param {HTMLElement} el current element\r\n * @returns {*} html element of type\r\n */\r\n getParentOfType: (parentType, el) => {\r\n if(el.nodeName === parentType.toUpperCase()) {\r\n return el;\r\n }\r\n\r\n return WPTB_Helper.getParentOfType(parentType , el.parentElement);\r\n },\r\n // current relative type of drag element\r\n // this type is used on differentiating certain elements based on their positioning on table\r\n dragRelativeType : '',\r\n /**\r\n *\r\n * @param {string} val drag relative type\r\n */\r\n setDragRelativeType: function (val){\r\n this.dragRelativeType = val;\r\n },\r\n // get drag relative type\r\n getDragRelativeType : function(){\r\n return this.dragRelativeType;\r\n },\r\n}\r\n","var WPTB_Initializer = function () {\r\n\r\n const MIN_COLUMNS = 1,\r\n MIN_ROWS = 1,\r\n MAX_COLUMNS = 30,\r\n MAX_ROWS = 30;\r\n\r\n var tableGenerator = document.body;\r\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\r\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\r\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\r\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\r\n columnsInput = document.getElementById('wptb-columns-number'),\r\n rowsInput = document.getElementById('wptb-rows-number');\r\n \r\n columnsDecrementButton.onclick = function () {\r\n if (columnsInput.value > MIN_COLUMNS) {\r\n columnsInput.value--;\r\n }\r\n };\r\n\r\n columnsIncrementButton.onclick = function () {\r\n if (columnsInput.value < MAX_COLUMNS) {\r\n columnsInput.value++;\r\n }\r\n };\r\n\r\n rowsDecrementButton.onclick = function () {\r\n if (rowsInput.value > MIN_ROWS) {\r\n rowsInput.value--;\r\n }\r\n };\r\n\r\n rowsIncrementButton.onclick = function () {\r\n if (rowsInput.value < MAX_ROWS) {\r\n rowsInput.value++;\r\n }\r\n };\r\n\r\n document.getElementById( 'wptb-generate-table' ).onclick = function ( ) {\r\n var columns = document.getElementById('wptb-columns-number').value,\r\n rows = document.getElementById('wptb-rows-number').value;\r\n\r\n //wptbTableStateSaveManager.tableStateClear();\r\n \r\n WPTB_Table(columns, rows);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n // register and setup section buttons\r\n WPTB_Helper.registerSections(['elements', 'table_settings', 'cell_settings', 'options_group' , 'table_responsive_menu']);\r\n WPTB_Helper.setupSectionButtons();\r\n\r\n // activate elements section for startup\r\n WPTB_Helper.activateSection('elements');\r\n\r\n // side bar toggle setup\r\n // WPTB_Helper.setupSidebarToggle('.wptb-panel-drawer-toggle');\r\n WPTB_Helper.setupSidebarToggle('.wptb-panel-toggle-section .wptb-panel-drawer-icon');\r\n\r\n // setup panel sections that have the ability to be toggled on/off\r\n WPTB_Helper.setupPanelToggleButtons();\r\n\r\n // setup responsive menu both at left and builder panel\r\n new WptbResponsive('table_responsive_menu', 'wptbResponsiveApp', '.wptb-builder-content');\r\n\r\n // get builder section from url parameter for easy switch at page load\r\n WPTB_Helper.getSectionFromUrl();\r\n};\r\n","var WPTB_innerElementSet = function ( element ) {\r\n \r\n element.ondragenter = function (e) {\r\n var div;\r\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\r\n return;\r\n }\r\n WPTB_DropHandle(this, e);\r\n \r\n element.classList.add( 'wptb-ondragenter' );\r\n }\r\n element.ondragover = function (e) {\r\n e.preventDefault();\r\n WPTB_DropHandle(this, e);\r\n }\r\n element.ondragleave = function (e) {\r\n WPTB_DropHandle(this, e, true);\r\n\r\n }\r\n element.ondrop = function(e) {\r\n this.classList.remove( 'wptb-ondragenter' );\r\n let element, classId;\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\r\n return;\r\n }\r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n }\r\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n\r\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\r\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\r\n element = element.getDOMElement();\r\n } else {\r\n classId = e.dataTransfer.getData( 'node' );\r\n element = document.getElementsByClassName( classId )[0];\r\n //element.classList.remove( 'wptb-moving-mode' );\r\n }\r\n\r\n if(WPTB_Helper.getDragRelativeType() === 'td_relative'){\r\n WPTB_DropHandle(this, e, true);\r\n const parentCell = WPTB_Helper.getParentOfType('td', e.target);\r\n\r\n parentCell.appendChild(element);\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n\r\n }else if( wptbDropHandle.style.display == 'block' ) {\r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n\r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode;\r\n if( WPTB_Helper.rowIsTop( thisRow ) ) { \r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n \r\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n }\r\n \r\n // start item javascript if item is new\r\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n let elemKind = infArr[1];\r\n if ( e.dataTransfer.getData( 'wptbElement' ) && ( elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list' ) ) {\r\n //WPTB_Helper.elementStartScript( element );\r\n }\r\n } else {\r\n return;\r\n }\r\n\r\n if(wptbDropHandle){\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n\r\n WPTB_innerElementSet( element );\r\n \r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\r\n element.classList.remove( 'wptb-moving-mode' );\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } \r\n return true;\r\n }\r\n element.onmouseover = function(e) {\r\n element.classList.remove( 'wptb-ondragenter' );\r\n }\r\n}","var WPTB_LeftPanel = function () {\r\n\r\n let table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n };\r\n \r\n if( table ) {\r\n let wptbTablesEditModeCloseButton = document.getElementsByClassName( 'wptb-table-edit-mode-close' );\r\n for ( let i = 0; i < wptbTablesEditModeCloseButton.length; i++ ) {\r\n wptbTablesEditModeCloseButton[i].onclick = WPTB_Helper.toggleTableEditMode;\r\n }\r\n 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 // this code hides the \"element parameters\" area\r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.onclick = function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n WPTB_Helper.clickOnFreeSpace();\r\n } \r\n };\r\n \r\n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\r\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\r\n wptbHeader.onclick = function() {\r\n WPTB_Helper.clickOnFreeSpace();\r\n };\r\n};","var MultipleSelect = function () {\r\n\r\n\tvar selectedCells = [],\r\n\t\tmultipleCellMode = false;\r\n\r\n\tthis.activateMultipleSelectMode = function () {\r\n\t\tselectedCells = [];\r\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n\t\tfor (var i = 0; i < tds.length; i++) {\r\n\t\t\ttds[i].classList.remove('wptb-highlighted');\r\n\t\t}\r\n\t\tmultipleCellMode = true;\r\n\t}\r\n\r\n\tthis.deactivateMultipleSelectMode = function () {\r\n\t\tmultipleCellMode = false;\r\n\t}\r\n\r\n\tthis.isActivated = function () {\r\n\t\treturn multipleCellMode;\r\n\t}\r\n\r\n\tthis.pushSelectedCell = function (cell) {\r\n\t\tif (!multipleCellMode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tselectedCells.push(cell);\r\n\t\tcell.classList.add('wptb-highlighted');\r\n\t};\r\n\r\n\tthis.selectedCells = function () {\r\n\t\treturn selectedCells;\r\n\t}\r\n\r\n\tthis.flushSelectedCells = function () {\r\n\t\tselectedCells = [];\r\n\t}\r\n\r\n\tthis.getFirst = function () {\r\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tfirst = selectedCells[i];\r\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn first;\r\n\t}\r\n\r\n\tthis.getLast = function () {\r\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tlast = selectedCells[i];\r\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn last;\r\n\t}\r\n\r\n\tthis.removeAllButFirst = function () {\r\n\t\tvar td = this.getFirst();\r\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\r\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\r\n\t\t}\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_Parser = function ( code ) {\r\n let div = document.createElement( 'div' );\r\n div.innerHTML = code;\r\n \r\n let table = div.children[0];\r\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\r\n \r\n for( let i = 0; i < columnTitleMobile.length; i++ ) {\r\n let parent = columnTitleMobile[i].parentNode;\r\n parent.removeChild( columnTitleMobile[i] );\r\n }\r\n \r\n let tds = table.querySelectorAll( 'td' );\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n tds[i].classList.add( 'wptb-droppable' );\r\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\r\n }\r\n \r\n return table;\r\n}","// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\r\nif (!Object.keys) {\r\n Object.keys = (function () {\r\n 'use strict';\r\n var hasOwnProperty = Object.prototype.hasOwnProperty,\r\n hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\r\n dontEnums = [\r\n 'toString',\r\n 'toLocaleString',\r\n 'valueOf',\r\n 'hasOwnProperty',\r\n 'isPrototypeOf',\r\n 'propertyIsEnumerable',\r\n 'constructor'\r\n ],\r\n dontEnumsLength = dontEnums.length;\r\n\r\n return function (obj) {\r\n if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\r\n throw new TypeError('Object.keys called on non-object');\r\n }\r\n\r\n var result = [], prop, i;\r\n\r\n for (prop in obj) {\r\n if (hasOwnProperty.call(obj, prop)) {\r\n result.push(prop);\r\n }\r\n }\r\n\r\n if (hasDontEnumBug) {\r\n for (i = 0; i < dontEnumsLength; i++) {\r\n if (hasOwnProperty.call(obj, dontEnums[i])) {\r\n result.push(dontEnums[i]);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n }());\r\n}","/**\r\n * Responsive menu and options class.\r\n *\r\n * This class will be called and instanced at table builder menu to add it the responsive menu and its controls.\r\n *\r\n * @param {string} sectionName section name\r\n * @param {string} responsiveWrapperId id for mount point\r\n * @param {string} mainContainerQuery query to find parent container for responsive menu\r\n * @throws {Error} will throw an error if mainContainerQuery failed to find any element\r\n * @constructor\r\n */\r\n// eslint-disable-next-line no-unused-vars\r\nfunction WptbResponsive(sectionName, responsiveWrapperId, mainContainerQuery) {\r\n\tthis.sectionName = sectionName;\r\n\tthis.responsiveWrapperId = responsiveWrapperId;\r\n\tthis.responsiveTable = null;\r\n\tthis.loaded = false;\r\n\r\n\t/**\r\n\t * Add responsive container to dom.\r\n\t */\r\n\tthis.addContainerToDom = () => {\r\n\t\tconst responsiveContainer = document.querySelector(`#${this.responsiveWrapperId}`);\r\n\t\tif (!responsiveContainer) {\r\n\t\t\tconst mainContainer = document.querySelector(mainContainerQuery);\r\n\r\n\t\t\t// parent container not found, throw error\r\n\t\t\tif (!mainContainer) {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t`[WPTB_Responsive]: no parent container is found with the given query of [${mainContainerQuery}]`\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tconst range = document.createRange();\r\n\t\t\trange.setStart(mainContainer, 0);\r\n\r\n\t\t\tconst responsiveElement = range.createContextualFragment(\r\n\t\t\t\t`<div class=\"wptb-responsive\" id=\"${this.responsiveWrapperId}\">responsive element</div>`\r\n\t\t\t);\r\n\t\t\tmainContainer.appendChild(responsiveElement);\r\n\t\t\tthis.loaded = true;\r\n\t\t}\r\n\r\n\t\tthis.responsiveTable = document.querySelector(`#${this.responsiveWrapperId}`);\r\n\t};\r\n\r\n\t/**\r\n\t * Load and make necessary mount preparations for component.\r\n\t */\r\n\tthis.load = () => {\r\n\t\tif (!this.loaded) {\r\n\t\t\tthis.addContainerToDom();\r\n\r\n\t\t\tWPTB_Helper.elementStartScript(this.responsiveTable, 'table_responsive_menu');\r\n\t\t\tWPTB_Helper.elementOptionsSet('table_responsive_menu', this.responsiveTable);\r\n\t\t\tWPTB_ControlsManager.callControlScript('ResponsiveTable', this.responsiveWrapperId);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Startup hook for the component.\r\n\t */\r\n\tthis.startUp = () => {\r\n\t\t// event listener for section change events\r\n\t\tdocument.addEventListener('wptbSectionChanged', (e) => {\r\n\t\t\tconst tablePreview = document.querySelector('.wptb-preview-table');\r\n\r\n\t\t\t// check if activated section is related to responsive and there is a main table already in the view\r\n\t\t\tif (e.detail === this.sectionName && tablePreview) {\r\n\t\t\t\tthis.load();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// event listener for table ready signal\r\n\t\tdocument.addEventListener('wptb:table:generated', () => {\r\n\t\t\t// check current section to be sure that responsive menu is the active one before calling load related scripts\r\n\t\t\tif (WPTB_Helper.getCurrentSection() === 'table_responsive_menu') {\r\n\t\t\t\tthis.load();\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\tthis.startUp();\r\n}\r\n","var WPTB_Settings = function () {\r\n var elems = document.getElementsByClassName('wptb-element');\r\n\r\n for ( var i = 0; i < elems.length; i++ ) {\r\n elems[i].ondragstart = function ( event ) {\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\r\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\r\n\r\n // set drag relative helper field for future use\r\n WPTB_Helper.setDragRelativeType(this.dataset.wptbRelativeElements || '');\r\n }\r\n elems[i].ondragend = function () {\r\n WPTB_Helper.elementDragEndClear();\r\n }\r\n };\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n \r\n wptbUndo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if(wptbUndoRedoContainer.length > 0) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n let table = document.querySelector( '.wptb-preview-table' );\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n \r\n wptbRedo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if(wptbUndoRedoContainer.length > 0) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n let table = document.querySelector( '.wptb-preview-table' );\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\r\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\r\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\r\n }\r\n }\r\n \r\n window.onbeforeunload = function(e) {\r\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\r\n if( wptbSaveDisabled.length == 0 ) {\r\n return true;\r\n } else {\r\n return null;\r\n }\r\n };\r\n \r\n \r\n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( event ) {\r\n if( this.classList.contains( 'wptb-button-disable' ) ) {\r\n return;\r\n } \r\n \r\n let previewId = Math.floor( Math.random() * 10000 );\r\n \r\n var newHref = new URL( event.target.href );\r\n newHref.searchParams.set( 'preview_id', previewId );\r\n event.target.href = newHref.toString();\r\n WPTB_Helper.saveTable( event, false, previewId );\r\n }\r\n\r\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\r\n if( ! this.classList.contains( 'wptb-save-disabled' ) ) {\r\n WPTB_Helper.saveTable( event );\r\n }\r\n }\r\n\r\n let tableTitleField = document.querySelector( '#wptb-setup-name' );\r\n if( tableTitleField ) {\r\n tableTitleField.onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n};\r\n","var WPTB_Stringifier = function ( codeMain ) {\r\n if ( codeMain ) {\r\n let code = codeMain.cloneNode( true );\r\n code.dataset.tableColumns = codeMain.columns;\r\n code.style.width = null;\r\n code.style.minWidth = null;\r\n code.style.maxWidth = null;\r\n \r\n let tds = code.getElementsByTagName( 'td' );\r\n if ( tds.length > 0 ) {\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n\r\n tds[i].removeAttribute( 'data-x-index' );\r\n tds[i].removeAttribute( 'data-y-index' );\r\n tds[i].removeAttribute( 'draggable' );\r\n tds[i].classList.remove( 'wptb-droppable' );\r\n let infArr = tds[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if(infArr) tds[i].classList.remove(infArr[0]);\r\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( innerElements.length > 0 ) {\r\n for ( let j = 0; j < innerElements.length; j++ ) {\r\n \r\n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n \r\n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n \r\n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n \r\n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n \r\n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n \r\n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\r\n let wptbActionsLength = wptbActions.length;\r\n while ( wptbActionsLength > 0 ) {\r\n if( wptbActions[0] && wptbActions[0].parentNode ) {\r\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\r\n wptbActionsLength--;\r\n } else {\r\n break;\r\n }\r\n \r\n } \r\n \r\n let dataMceBogus = innerElements[j].querySelectorAll( '[data-mce-bogus]' );\r\n if( dataMceBogus.length > 0 ) {\r\n dataMceBogus = [...dataMceBogus];\r\n for( let k = 0; k < dataMceBogus.length; k++ ) {\r\n if( dataMceBogus[k] && dataMceBogus[k].parentNode ) {\r\n dataMceBogus[k].parentNode.removeChild( dataMceBogus[k] );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // TODO dataTitleColumnSet\r\n // if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\r\n // let columnNameDivContainer = document.createElement( 'div' ),\r\n // columnNameDiv = document.createElement( 'div' );\r\n // columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\r\n // columnNameDiv.classList.add( 'wptb-column-title-mobile' );\r\n // columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\r\n // columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\r\n // color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\r\n // columnNameDiv.style.padding = tds[i].style.padding;\r\n // if( tds[i].children.length == 0 ) {\r\n // tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\r\n // }\r\n // columnNameDivContainer.appendChild( columnNameDiv );\r\n // tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\r\n // }\r\n }\r\n }\r\n \r\n return code;\r\n }\r\n}","var array = [], WPTB_Table = function ( columns, rows, wptb_preview_table ) {\r\n\r\n /* The members of the class */\r\n var settings = document.getElementsByClassName('wptb-settings-items'),\r\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\r\n table, row, cell,\r\n maxAmountOfCells,\r\n maxAmountOfRows;\r\n\r\n //HERE ARE THE PRIVATE FUNCTIONS\r\n /*\r\n * This function toggles buttons visibility in cell edit mode\r\n * (according to the amount of currently selected cells), and\r\n * highlights visually the clicked cell if it is not highlighted, or\r\n * removes highlight if clicked cell is already highlighted. \r\n * It too toggles the bits of our abstract representation.\r\n * @param Event this is the event instance of the click performed over a cell.\r\n */\r\n var mark = function ( event ) {\r\n let thisElem = event.currentTarget;\r\n let rs = thisElem.rowSpan,\r\n cs = thisElem.colSpan,\r\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n position = getCoords(thisElem),\r\n row = position[0],\r\n column = position[1];\r\n if ( ! document.select.isActivated() ) {\r\n return;\r\n }\r\n if (thisElem.className.match(/wptb-highlighted/)) {\r\n thisElem.classList.remove('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 0;\r\n }\r\n }\r\n } else {\r\n thisElem.classList.add('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 1;\r\n }\r\n }\r\n }\r\n\r\n let cellHighlighted = document.getElementsByClassName('wptb-highlighted'),\r\n markedCells = cellHighlighted.length;\r\n if (markedCells === 0) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n } else if (markedCells === 1) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.add('visible');\r\n singleCells[i].removeAttribute('disabled');\r\n }\r\n\r\n cellHighlighted = cellHighlighted[0];\r\n WPTB_Helper.elementOptionsSet( 'table_cell_setting', cellHighlighted );\r\n\r\n let infArr = cellHighlighted.className.match( /wptb-element-((.+-)\\d+)/i );\r\n\r\n const controlElemIds = ['cellWidth', 'cellHeight'];\r\n\r\n controlElemIds.map(s => {\r\n let elementControlSizeUnicClass = `wptb-el-${infArr[1]}-${s}`,\r\n elementControlSizeFixedUnicClass = `wptb-el-${infArr[1]}-${s}Fixed`;\r\n if(s === 'cellWidth' || s === 'cellHeight') {\r\n let sizeName = '',\r\n getSizeFunctionName = '';\r\n if(s === 'cellWidth') {\r\n sizeName = 'width';\r\n getSizeFunctionName = 'getColumnWidth';\r\n } else if(s === 'cellHeight') {\r\n sizeName = 'height';\r\n getSizeFunctionName = 'getRowHeight';\r\n }\r\n let size = cellHighlighted.style[sizeName],\r\n cellSizeInputs = document.querySelectorAll( '.' + elementControlSizeUnicClass ),\r\n cellSizeFixedInput = document.querySelector( '.' + elementControlSizeFixedUnicClass );\r\n cellSizeInputs = [...cellSizeInputs];\r\n\r\n if(!size && !cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`]) {\r\n size = WPTB_Helper[getSizeFunctionName](table, cellHighlighted);\r\n cellSizeInputs.map(s => {\r\n s.value = size;\r\n });\r\n\r\n cellSizeFixedInput.checked = false;\r\n } else {\r\n cellSizeInputs.map(s => {\r\n if( size ) {\r\n s.value = parseFloat( size, 10 );\r\n } else if( cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`] ) {\r\n s.value = cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`];\r\n }\r\n });\r\n\r\n cellSizeFixedInput.checked = true;\r\n }\r\n }\r\n });\r\n\r\n cellSettings.classList.add( 'visible' );\r\n } else {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n if (table.isSquare(array)) {\r\n multipleCells[i].classList.add('visible');\r\n multipleCells[i].removeAttribute('disabled');\r\n } else {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n }\r\n\r\n /**\r\n * empty cell setting\r\n */\r\n // let emptySetting = document.\r\n const infArr = thisElem.className.match(/wptb-element-table_cell_setting-((.+-)\\d+)/i);\r\n if (infArr && infArr.length > 1) {\r\n const controlKey = 'emptyCell';\r\n const settingId = `wptb-el-table_cell_setting-${infArr[1]}-${controlKey}`;\r\n const settingElem = document.getElementById(settingId);\r\n if (settingElem) {\r\n settingElem.querySelector('input[type=\"checkbox\"]').checked = thisElem.classList.contains('wptb-empty')\r\n }\r\n }\r\n \r\n\r\n let details = {countMarkedCells:markedCells};\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/cell/mark', thisElem, details);\r\n };\r\n\r\n /* \r\n * This function fills an array with 1's according to the actual design\r\n * of HTML table.\r\n * @returns an array of arrays containing an abstract representation\r\n * of HTML table.\r\n * @deprecated\r\n * */\r\n\r\n var realTimeArray = function () {\r\n var carried = [], tds, cols, matriz = [];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n cols = [];\r\n\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n\r\n for (items = 0; items < tds.length; items++) {\r\n\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n cols.push(1);\r\n }\r\n\r\n if (tds[items].rowSpan > 1) {\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n carried[items + k] = {\r\n justAssigned: true,\r\n amount: tds[items].rowSpan\r\n };\r\n }\r\n }\r\n }\r\n\r\n for (var k = 0; k < maxAmountOfCells; k++) {\r\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\r\n carried[k].amount--;\r\n if (carried[k].justAssigned) {\r\n carried[k].justAssigned = false;\r\n } else {\r\n cols.push(1);\r\n }\r\n }\r\n }\r\n\r\n matriz.push(cols);\r\n\r\n }\r\n return matriz;\r\n };\r\n\r\n /*\r\n * This function gets the number and position of cell spaces in current row that are occuped \r\n * by upper rowspanned cells.\r\n * @param number the number of row where we wish to calculate the carried rowspans up to.\r\n * @return an array with the remaining rowspans in each column.\r\n */\r\n var carriedRowspans = function (row) {\r\n var carried = [], tds, cols;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n if (row == -1) {\r\n return carried;\r\n }\r\n\r\n for (var i = 0; i <= row; i++) {\r\n cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (carried[xPosition]) {\r\n carried[xPosition]--;\r\n } else {\r\n celda = cellsBuffer[cellPointer++];\r\n if (celda.rowSpan > 1) {\r\n for (k = 0; k < celda.colSpan; k++) {\r\n carried[xPosition + k] = celda.rowSpan - 1;\r\n }\r\n stepsToMove = celda.colSpan;\r\n } else if (celda.colSpan > 1) {\r\n stepsToMove = celda.colSpan;\r\n }\r\n }\r\n }\r\n\r\n }\r\n return carried;\r\n };\r\n\r\n /*\r\n * A helpful function for showing\r\n * the abstract table in console.\r\n * @param Array our abstract table.\r\n */\r\n var drawTable = function (a) {\r\n var string = 'DRAWING TABLE:\\n';\r\n for (var i = 0; i < a.length; i++) {\r\n\r\n for (var j = 0; j < a[i].length; j++) {\r\n string += ' ' + a[i][j];\r\n }\r\n string += '\\n';\r\n }\r\n table.isSquare(a);\r\n };\r\n\r\n /*\r\n * It resets all the bits of our abstract representation\r\n * to 0 and removes the highlighting class of all cells.\r\n */\r\n\r\n var undoSelect = function () {\r\n let noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n tds = table.getElementsByClassName('wptb-highlighted');\r\n while (tds.length) {\r\n tds[0].classList.remove('wptb-highlighted');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n for (let i = 0; i < array.length; i++) {\r\n for (let j = 0; j < array[i].length; j++) {\r\n array[i][j] = 0;\r\n }\r\n }\r\n for (let i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (let i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (let i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/undo-select/active', table);\r\n };\r\n\r\n /*\r\n * This fills the abstract representation of our table with \r\n * zeros, at the start. the max amount of cells is the greatest sum\r\n * of all colspans for row.\r\n */\r\n\r\n var fillTableArray = function () {\r\n var colspansSums = [], a = [];\r\n\r\n //calculate max amount of cells inside a row\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cells = table.rows[i].getElementsByTagName('td'),\r\n colspanSumInRow = 0;\r\n for (var j = 0; j < cells.length; j++) {\r\n colspanSumInRow += cells[j].colSpan;\r\n }\r\n colspansSums.push(colspanSumInRow);\r\n }\r\n\r\n maxAmountOfCells = Math.max.apply(null, colspansSums);\r\n //calculate max rows\r\n var maxAmountOfRows = table.rows.length;\r\n\r\n // fill with zeros from both values\r\n for (var i = 0; i < maxAmountOfRows; i++) {\r\n a[i] = [];\r\n for (var j = 0; j < maxAmountOfCells; j++) {\r\n a[i].push(0);\r\n }\r\n }\r\n drawTable(a);\r\n return a;\r\n };\r\n\r\n /*\r\n * This function gets the sum of all colspans in a row.\r\n * @param number the number of row to be used as reference.\r\n */\r\n var getActualPointsInRow = function (row) {\r\n var tds = table.rows[row].getElementsByTagName('td'),\r\n points = 0;\r\n for (var i = 0; i < tds.length; i++) {\r\n points += tds[i].colSpan;\r\n }\r\n return points;\r\n }\r\n\r\n /*\r\n * This function gets us the exact coordinates of\r\n * an exact cell, in a more reliable way than xIndex and yIndex,\r\n * these last ones were meant to be used for getting the cell trough them.\r\n * @param DOMElement the cell to get the coordinates.\r\n */\r\n var getCoords = function (search) {\r\n var skipInCols = [], cell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n skipInCols[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (skipInCols[xPosition]) {\r\n skipInCols[xPosition]--;\r\n } else {\r\n var td = cellsBuffer[cellPointer++];\r\n if (td == search) {\r\n return [i, xPosition];\r\n }\r\n if (td.rowSpan > 1) {\r\n for ( let k = 0; k < td.colSpan; k++ ) {\r\n skipInCols[xPosition + k] = td.rowSpan - 1;\r\n }\r\n stepsToMove = td.colSpan;\r\n } else if (td.colSpan > 1) {\r\n stepsToMove = td.colSpan;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n jQuery('#wptb-table-border-color').val('');\r\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\r\n\r\n if ( columns || rows ) {\r\n //END OF PRIVATE FUNCTIONS\r\n for (var i = 0; i < settings.length; i++) {\r\n if (settings[i].id !== 'wptb-apply-inner-border') {\r\n settings[i].classList.add('visible');\r\n }\r\n }\r\n\r\n //Create a HTML Table element.\r\n table = document.createElement( 'table' );\r\n table.classList.add( 'wptb-preview-table', 'wptb-element-main-table_setting-startedid-0' );\r\n table.style.border = '0px solid';\r\n table.dataset.reconstraction = 1;\r\n //table.dataset.wptbAdaptiveTable = 1;\r\n //Add the data rows.\r\n for (var i = 0; i < rows; i++) {\r\n\r\n row = table.insertRow(-1);\r\n row.classList.add( 'wptb-row' );\r\n\r\n for (var j = 0; j < columns; j++) {\r\n cell = new WPTB_Cell(mark);\r\n cell.setCoords(i, j);\r\n cell.getDOMElement().style.borderWidth = '1px';\r\n row.appendChild(cell.getDOMElement());\r\n }\r\n }\r\n } else {\r\n if( ! wptb_preview_table ) wptb_preview_table = document.querySelector( '.wptb-preview-table' );\r\n\r\n if ( wptb_preview_table ) {\r\n table = wptb_preview_table;\r\n\r\n let cells = table.getElementsByTagName('td');\r\n\r\n if (cells.length > 0) {\r\n for (let i = 0; i < cells.length; i++) {\r\n WPTB_Cell(mark, cells[i]);\r\n }\r\n }\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * this method run \"mark\" method of WPTB_Table object\r\n * @param event\r\n */\r\n table.mark = (event) => {\r\n mark(event);\r\n }\r\n\r\n /**\r\n * this method run \"undoSelect\" method of WPTB_Table object\r\n * @param event\r\n */\r\n table.undoSelect = () => {\r\n undoSelect();\r\n }\r\n\r\n /**\r\n * method for set value for maxAmountOfCells\r\n * @param value\r\n */\r\n table.setMaxAmountOfCells = (value) => {\r\n maxAmountOfCells = value;\r\n }\r\n\r\n /**\r\n * this method return maxAmountOfCells value\r\n * @returns {*}\r\n */\r\n table.getMaxAmountOfCells = () => {\r\n return maxAmountOfCells;\r\n }\r\n\r\n /**\r\n * this method run \"fillTableArray\" method of WPTB_Table object\r\n * @returns {[]}\r\n */\r\n table.fillTableArray = () => {\r\n return fillTableArray();\r\n }\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table. \r\n */\r\n\r\n table.recalculateIndexes = function () {\r\n WPTB_Helper.recalculateIndexes( this );\r\n }\r\n \r\n table.addColumnWidth = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataXIndex = highlighted[k].dataset.xIndex;\r\n if( dataXIndex ) {\r\n function tableTdsFor( dataXIndex, colspan ) {\r\n let tableRows = table.rows;\r\n let widthIsSet = false;\r\n let arrayTdsFromPreviousRow = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.xIndex == dataXIndex ) {\r\n if( value ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n widthIsSet = true;\r\n } else {\r\n td.style.width = null;\r\n td.dataset.wptbFixedWidth = value;\r\n if( i == tableRows.length - 1 && ! widthIsSet ) {\r\n tableTdsFor( dataXIndex, colspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.width = null;\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } else {\r\n if( td.dataset.wptbFixedWidth ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = td.dataset.wptbFixedWidth + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } \r\n } else if( td.style.width ) {\r\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\r\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\r\n }\r\n arrayTdsFromPreviousRow = [];\r\n } else {\r\n arrayTdsFromPreviousRow.push( td );\r\n }\r\n }\r\n break;\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataXIndex, 1 );\r\n }\r\n }\r\n \r\n table.tdDefaultWidth();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n }\r\n }\r\n \r\n table.tdDefaultWidth = function() {\r\n let rows = table.rows;\r\n \r\n let tableTdsSumMaxWidth = 0;\r\n let tableTdsSumMaxWidthFixed = 0;\r\n let tableTdsSumMaxWidthAuto = 0;\r\n \r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n \r\n let arrayCellsWidthFixedHelper = [];\r\n let arrayCellsWidthAutoHelper = [];\r\n let tdPaddingCommon = 0;\r\n let tableTdBorderCommonWidth = 0;\r\n let cssForTdsWidthAuto = '';\r\n \r\n \r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\r\n \r\n for( let i = 0; i < rows.length; i++ ) {\r\n let tds = rows[i].children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n \r\n if( ! arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\r\n if( td.style.width ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] = parseFloat( td.style.width );\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n } else {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] = table.dataset.wptbTdWidthAuto ? parseFloat( table.dataset.wptbTdWidthAuto, 10 ) : 100;\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n }\r\n \r\n if( window.getComputedStyle( td, null ) ) {\r\n let tdStyleObj = window.getComputedStyle( td, null );\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\r\n\r\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\r\n tableTdBorderCommonWidth = tableTdBorderCommonWidth / 2;\r\n \r\n if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n \r\n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\r\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\r\n }\r\n\r\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\r\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n \r\n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\r\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\r\n }\r\n\r\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\r\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\r\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\r\n }\r\n }\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n } else if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n }\r\n }\r\n }\r\n \r\n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\r\n if( arrayCellsWidthFixedHelper[i] ) {\r\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\r\n }\r\n }\r\n \r\n let CellsWidthAutoCount = 0;\r\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\r\n if( arrayCellsWidthAutoHelper[i] ) {\r\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\r\n CellsWidthAutoCount++;\r\n }\r\n }\r\n \r\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto;\r\n \r\n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\r\n if( CellsWidthAutoCount ) {\r\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\r\n if( table.mergingСellsHorizontally ) {\r\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed;\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n }\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\r\n }\r\n \r\n let styleElementCreate = false;\r\n let tableTdWidthAuto;\r\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\r\n if( CellsWidthAutoCount ) {\r\n table.style.minWidth = '100%';\r\n if( table.mergingСellsHorizontally ) {\r\n table.style.width = 'auto';\r\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed;\r\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\r\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\r\n styleElementCreate = true;\r\n } else {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.width = 'auto';\r\n table.style.minWidth = null;\r\n table.style.maxWidth = null;\r\n }\r\n } else {\r\n table.style.maxWidth = null;\r\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\r\n table.style.width = 'auto';\r\n tableTdWidthAuto = table.dataset.wptbTdWidthAuto ? table.dataset.wptbTdWidthAuto : '100';\r\n styleElementCreate = true;\r\n }\r\n \r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAutoOld ) {\r\n head.removeChild( cssForTdsWidthAutoOld );\r\n }\r\n }\r\n \r\n if( styleElementCreate ) {\r\n cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\r\n if( head ) {\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n \r\n if( table.dataset.wptbTableAlignment ) {\r\n let wptbTableAlignment = table.dataset.wptbTableAlignment;\r\n\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n if( wptbTableSetupWidth < table.offsetWidth ) {\r\n table.style.float = null;\r\n } else {\r\n if( wptbTableAlignment == 'center' ) {\r\n table.style.float = null;\r\n } else {\r\n table.style.float = wptbTableAlignment;\r\n }\r\n }\r\n\r\n if( wptbTableAlignment == 'center' ) {\r\n wptbTableSetup.style.float = null;\r\n } else {\r\n wptbTableSetup.style.float = wptbTableAlignment;\r\n }\r\n \r\n if( tableTdWidthAuto && table.dataset.wptbTableContainerMaxWidth && table.offsetWidth < table.dataset.wptbTableContainerMaxWidth ) {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.float = null;\r\n }\r\n }\r\n \r\n table.addRowHeight = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataYIndex = highlighted[k].dataset.yIndex;\r\n if( dataYIndex ) {\r\n function tableTdsFor( dataYIndex, rowspan ) {\r\n let tableRows = table.rows;\r\n let heightIsSet = false;\r\n let arrayTdsPrevious = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.yIndex == dataYIndex ) {\r\n if( value ) {\r\n if( td.rowSpan == rowspan ) {\r\n td.style.height = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n heightIsSet = true;\r\n continue;\r\n } else {\r\n td.style.height = null;\r\n td.dataset.wptbFixedHeight = value;\r\n if( j == tds.length - 1 && ! heightIsSet ) {\r\n tableTdsFor( dataYIndex , rowspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.height = null;\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n } else {\r\n if( td.dataset.wptbFixedHeight ) {\r\n if( td.rowSpan = rowspan ) {\r\n td.style.height = td.dataset.wptbFixedHeight + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n }\r\n } else if( td.style.height ) {\r\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\r\n arrayTdsPrevious[z].style.height = td.style.height;\r\n }\r\n arrayTdsPrevious = [];\r\n } else {\r\n arrayTdsPrevious.push( td );\r\n }\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataYIndex, 1 );\r\n }\r\n }\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n }\r\n }\r\n \r\n table.reconstraction = function() {\r\n let tds = table.getElementsByTagName( 'td' );\r\n table.mergingСellsHorizontally = false;\r\n table.mergingCellsVertically = false;\r\n table.dataset.reconstraction = 1;\r\n let forBreak = 0;\r\n for( let i = 0; i < tds.length; i++ ) {\r\n if( tds[i].colSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n table.mergingСellsHorizontally = true;\r\n forBreak++;\r\n }\r\n \r\n if( tds[i].rowSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n table.mergingCellsVertically = true;\r\n forBreak++;\r\n }\r\n \r\n if( forBreak == 2 ) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * As simple as it is: adds a column to the end of table.\r\n */\r\n table.addColumnEnd = function () {\r\n let td,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n \r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n }\r\n \r\n table.rows[i].appendChild(td.getDOMElement());\r\n array[i].push(0);\r\n }\r\n \r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * As simple as it looks: adds a column to the start of table.\r\n */\r\n\r\n table.addColumnStart = function () {\r\n let td,\r\n firstCell,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if ( currentTable.length > 0 ) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if ( currentTableTd ) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n }\r\n firstCell = table.rows[i].getElementsByTagName('td')[0];\r\n if (firstCell) {\r\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\r\n } else {\r\n table.rows[i].appendChild(td.getDOMElement());\r\n }\r\n array[i].push(0);\r\n }\r\n\r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Well, not so simple as previous functions.\r\n * It adds a column after a certain column of reference.\r\n * @param integer the column number to be used as reference.\r\n *\tIf empty, then the first highlighted cell is used as reference.\r\n */\r\n\r\n table.addColumnAfter = function (c_pos) {\r\n let rows = table.rows,\r\n cell,\r\n cellStyle,\r\n pos;\r\n\r\n if(c_pos != undefined && typeof c_pos === 'number') {\r\n pos = c_pos;\r\n cell = document.querySelector('[data-x-index=\"' + pos + '\"]');\r\n } else {\r\n cell = document.querySelector('.wptb-highlighted');\r\n pos = getCoords(cell)[1];\r\n }\r\n\r\n if(cell) {\r\n cellStyle = cell.getAttribute('style');\r\n\r\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\r\n table.addColumnEnd();\r\n } else {\r\n for(let i = 0; i < rows.length; i++) {\r\n let tds = rows[i].children;\r\n for(let j = 0; j < tds.length; j++) {\r\n if(parseInt(tds[j].dataset.xIndex) <= pos) {\r\n if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan == pos + cell.colSpan) {\r\n let td = newTd(cellStyle);\r\n let nextSib = tds[j].nextSibling;\r\n if (nextSib) {\r\n rows[i].insertBefore(td.getDOMElement(), nextSib);\r\n } else {\r\n rows[i].appendChild(td.getDOMElement());\r\n }\r\n\r\n break;\r\n } else if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan > pos + cell.colSpan) {\r\n tds[j].colSpan++;\r\n if(tds[j].rowSpan > 1) i += tds[j].rowSpan - 1;\r\n break;\r\n }\r\n } else if(parseInt(tds[j].dataset.xIndex) > pos) {\r\n let td = newTd(cellStyle);\r\n rows[i].insertBefore(td.getDOMElement(), tds[j]);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n function newTd(cellStyle) {\r\n let td = new WPTB_Cell(mark);\r\n if (cellStyle) {\r\n td.getDOMElement().setAttribute('style', cellStyle);\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n }\r\n return td;\r\n }\r\n\r\n for (var i = 0; i < array.length; i++) {\r\n array[i].push(0);\r\n }\r\n maxAmountOfCells++;\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * For preventing us to take a lot of time,\r\n * This is just calling the function addColumnAfter, but\r\n * using the previous column to current one as reference.\r\n * @see addColumnAfter\r\n */\r\n\r\n table.addColumnBefore = function () {\r\n var cell = document.querySelector('.wptb-highlighted'),\r\n pos = getCoords(cell)[1];\r\n\r\n if (pos === 0) {\r\n table.addColumnStart();\r\n } else {\r\n table.addColumnAfter(pos - 1);\r\n }\r\n };\r\n\r\n /*\r\n * Luckily, thisfunction is simple, \r\n * it just add a row to the end of table.\r\n */\r\n\r\n table.addRowToTheEnd = function () {\r\n let r = table.insertRow(-1),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table');\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTable = currentTable[0];\r\n \r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\r\n if( currentTableTd ) {\r\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\r\n \r\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\r\n td.getDOMElement().style.height = null;\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n \r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /*\r\n * Yet another simple function, \r\n * it just add a row to the start of table.\r\n */\r\n\r\n table.addRowToTheStart = function () {\r\n let r = table.insertRow(0),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTable = currentTable[0];\r\n \r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\r\n if( currentTableTd ) {\r\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\r\n \r\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\r\n td.getDOMElement().style.height = null;\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n \r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /* \r\n * This function adds a row before the current one.\r\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\r\n * the most of the troubles is not here.\r\n */\r\n\r\n table.addRowBefore = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellNew;\r\n for( let i = row - 1; i >= 0; i-- ) {\r\n let rowChildren = table.rows[i].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for( let j = 0; j < rowChildrenLength; j++ ) {\r\n if( rowChildren[j].rowSpan == 1 ) {\r\n row = i;\r\n cellNew = true;\r\n break;\r\n }\r\n }\r\n }\r\n if ( cellNew ) {\r\n break;\r\n }\r\n }\r\n\r\n if (row === 0) {\r\n table.addRowToTheStart();\r\n } else {\r\n table.addRowAfter( row, cellStyle );\r\n }\r\n };\r\n\r\n /*\r\n * Well... by the name convention of the previous 3 functions,\r\n * it's pretty obvious that this functions attaches a new\r\n * row after highlighted cell row. The greatest obstacle it was\r\n * the possibility of a TR not having the exact amount of columns\r\n * occuped by actual node but rowspanned upper cells. For that purpose\r\n * it was created the function realTimeArray.\r\n * @see realTimeArray\r\n */\r\n\r\n table.addRowAfter = function ( row, cellStyle ) {\r\n let cellRowSpan,\r\n rowAfter,\r\n aux;\r\n \r\n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\r\n let cell = document.querySelector('.wptb-highlighted');\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellRowSpan = cell.rowSpan,\r\n rowAfter = row + cellRowSpan - 1;\r\n } else {\r\n rowAfter = row;\r\n }\r\n \r\n \r\n let cellsColSpan = 0;\r\n if ( rowAfter < table.rows.length -1 ) {\r\n for( let i = 0; i <= rowAfter ; i++ ) {\r\n let tableRowsIChildren = table.rows[i].children,\r\n tableRIChildrenLength = tableRowsIChildren.length;\r\n if( tableRIChildrenLength > 0 ) {\r\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\r\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\r\n\r\n if ( rowIRowSpan - 1 + i > rowAfter ) {\r\n tableRowsIChildren[j].rowSpan++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let rNext = table.rows[rowAfter + 1],\r\n rNextChildren = rNext.children,\r\n rNextChildrenLength = rNextChildren.length;\r\n \r\n if( rNextChildrenLength > 0 ) {\r\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\r\n cellsColSpan += rNextChildren[i].colSpan;\r\n }\r\n }\r\n } else {\r\n cellsColSpan = array[0].length;\r\n }\r\n \r\n let r = table.insertRow( rowAfter + 1 );\r\n r.classList.add( 'wptb-row' );\r\n \r\n for ( j = 0; j < cellsColSpan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n 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 WPTB_Helper.tableRowsColorsReinstall( table );\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after');\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This function checks the current selected cells\r\n * make a rectangular shape.\r\n * @param Array the abstract table.\r\n * @return false, if not making a rectangle, or\r\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\r\n */\r\n\r\n table.isSquare = function (a) {\r\n var rowStart = -1,\r\n columnStart = -1,\r\n rowEnd = -1,\r\n columnEnd = -1,\r\n height,\r\n width,\r\n itemsEstimate = 0,\r\n items = 0;\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n if ( j < columnStart || columnStart == -1 ) {\r\n columnStart = j;\r\n }\r\n if ( i < rowStart || rowStart == -1 ) {\r\n rowStart = i;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n for (var i = a.length - 1; i > -1; i--) {\r\n for (var j = a[i].length - 1; j > -1; j--) {\r\n if (a[i][j] == 1) {\r\n if ( j > columnEnd ) {\r\n columnEnd = j;\r\n }\r\n if ( i > rowEnd ) {\r\n rowEnd = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = rowStart; i < rowEnd; i++) {\r\n for (var j = columnStart; j < columnEnd; j++) {\r\n if (a[i][j] == 0 || a[i][j] == undefined) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n items++;\r\n }\r\n }\r\n }\r\n\r\n height = rowEnd - rowStart + 1;\r\n width = columnEnd - columnStart + 1;\r\n itemsEstimate = height * width;\r\n\r\n if (itemsEstimate !== items) {\r\n return false;\r\n }\r\n return [height, width];\r\n };\r\n\r\n /*\r\n * This function merges all selected cells.\r\n * Well, actually sets the colspan and rowspan of first \r\n * upper left cell in selection and deletes the another selected cells.\r\n */\r\n\r\n table.mergeCells = function () {\r\n var dimensions = table.isSquare(array),\r\n rowspan = dimensions[0],\r\n colspan = dimensions[1],\r\n first = document.querySelector('.wptb-highlighted'),\r\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\r\n tdsChildrenNew = [];\r\n\r\n for (let i = 0; i < tds.length; i++) {\r\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\r\n if (tdsInternalElements.length > 0) {\r\n let tdsIntElemLength = tdsInternalElements.length;\r\n for (let j = 0; j < tdsIntElemLength; j++) {\r\n tdsChildrenNew.push(tdsInternalElements[j]);\r\n }\r\n }\r\n let p = tds[i].parentNode;\r\n p.removeChild(tds[i]);\r\n }\r\n if (tdsChildrenNew.length > 0) {\r\n for (let i = 0; i < tdsChildrenNew.length; i++) {\r\n first.appendChild(tdsChildrenNew[i]);\r\n }\r\n }\r\n\r\n first.colSpan = colspan;\r\n first.rowSpan = rowspan;\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n let firstWidth = first.style.width;\r\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\r\n if( firstWidth ) {\r\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\r\n } else if( firstDataFixedWidth ) {\r\n table.addColumnWidth();\r\n } else {\r\n table.addColumnWidth( false, true );\r\n }\r\n \r\n let firstHeight = first.style.height;\r\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\r\n if( firstHeight ) {\r\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\r\n } else if( firstDataFixedHeight ) {\r\n table.addRowHeight();\r\n } else {\r\n table.addRowHeight( false, true );\r\n }\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This functions makes the exact inverse as above.\r\n * It resets colspan and rowspan and appends \r\n * the same amount in cells to the table.\r\n * @bug\r\n */\r\n\r\n table.splitCell = function () {\r\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\r\n rowspan = cell.rowSpan,\r\n colspan = cell.colSpan,\r\n cellStyles = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n thisRow = table.rows[row],\r\n cellXIndex =cell.dataset.xIndex;\r\n \r\n cell.rowSpan = 1;\r\n cell.colSpan = 1;\r\n \r\n for (let i = 1; i < colspan; i++) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().classList.add( 'wptb-highlighted' );\r\n if ( cell.nextSibling ) {\r\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\r\n } else {\r\n thisRow.appendChild( td.getDOMElement() );\r\n }\r\n \r\n }\r\n\r\n if (rowspan > 1) {\r\n for (let i = 1; i < rowspan; i++) {\r\n let rowChildInsertBefore = undefined,\r\n rowNext = table.rows[row + i],\r\n rowChildren = rowNext.children,\r\n rowChildrenLength = rowChildren.length;\r\n \r\n if ( rowChildrenLength > 0 ) {\r\n for ( let k = 0; k < rowChildrenLength; k++ ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\r\n rowChildInsertBefore = rowChildren[k];\r\n break;\r\n } \r\n }\r\n }\r\n for ( let j = 0; j < colspan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyles );\r\n if ( rowChildInsertBefore != undefined ) {\r\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\r\n } else {\r\n rowNext.appendChild( td.getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Searches for rowspanned cells up to row number meeting it.\r\n * @param number the number of row where the function\r\n * must search up to.\r\n */\r\n\r\n table.findRowspannedCells = function (row) {\r\n var array = [],\r\n difference;\r\n actualPoints = getActualPointsInRow(row);\r\n if (actualPoints === maxAmountOfCells) {\r\n return [];\r\n }\r\n difference = maxAmountOfCells - actualPoints;\r\n\r\n for (var i = row - 1; i >= 0 && difference; i--) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n if (tds[i].rowSpan > 1) {\r\n array.push(tds[i]);\r\n difference -= tds[i].colSpan;\r\n }\r\n }\r\n }\r\n return array;\r\n\r\n }\r\n\r\n /*\r\n * This function explores the table and adds \r\n * a cell for each lacking one for each row\r\n * to meet an even amount of cells.\r\n */\r\n\r\n table.addLackingCells = function () {\r\n var sumRows = [];\r\n for (var i = 0; i < table.rows.length; i++) {\r\n sumRows.push(0);\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tds[j].rowSpan > 1) {\r\n for (var k = 1; k < tds[j].rowSpan; k++) {\r\n sumRows[i + k]++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td'),\r\n totalColspan = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n totalColspan += tds[j].colSpan;\r\n }\r\n totalColspan += sumRows[i];\r\n difference = maxAmountOfCells - totalColspan;\r\n for (var j = 0; j < difference; j++) {\r\n var td = new WPTB_Cell(mark);\r\n table.rows[i].appendChild(td.getDOMElement());\r\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * This function deletes the row of currently\r\n * selected cell. \r\n */\r\n\r\n table.deleteRow = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyles = cell.getAttribute('style'),\r\n rowspan = cell.rowSpan,\r\n row = getCoords(cell)[0],\r\n thisRow,\r\n aux;\r\n \r\n if ( rowspan == undefined ) rowspan = 1;\r\n \r\n for ( let i = 0; i < rowspan; i++ ) {\r\n thisRow = table.rows[row];\r\n let thisRowChildren = thisRow.children,\r\n nextRow = table.rows[row + 1],\r\n nextRowChildren,\r\n nextRowChildrenLength,\r\n tdArr = [];\r\n\r\n if( nextRow != undefined ) {\r\n nextRowChildren = nextRow.children;\r\n nextRowChildrenLength = nextRowChildren.length;\r\n for (let j = 0; j < thisRowChildren.length; j++) {\r\n if ( thisRowChildren[j].rowSpan > 1 ) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\r\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\r\n\r\n let nextRowChildrenK = undefined;\r\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\r\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\r\n nextRowChildrenK = nextRowChildren[k];\r\n break;\r\n } \r\n }\r\n\r\n if ( nextRowChildrenK ) {\r\n tdArr.push( [td, nextRowChildrenK] );\r\n } else {\r\n tdArr.push( [td] );\r\n }\r\n }\r\n }\r\n\r\n if ( tdArr.length > 0 ) {\r\n for ( let k = 0; k < tdArr.length; k++ ) {\r\n if ( tdArr[k][1] != undefined ) {\r\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\r\n } else {\r\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n \r\n let tableRows = table.rows;\r\n if ( tableRows.length > 0 ) {\r\n for ( let j = 0; j < row; j++ ) {\r\n let jRowChildren = tableRows[j].children;\r\n if ( jRowChildren.length > 0 ) {\r\n for ( let x = 0; x < jRowChildren.length; x++ ) {\r\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\r\n jRowChildren[x].rowSpan--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n aux = Array.from(array[0]);\r\n array.pop(aux);\r\n drawTable(array);\r\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\r\n \r\n if( table.rows.length == 0 ) {\r\n WPTB_Helper.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n \r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else {\r\n table.recalculateIndexes();\r\n WPTB_Helper.tableRowsColorsReinstall( table );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n table.reconstraction();\r\n }\r\n }\r\n \r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n /*\r\n * This function deletes the column of currently\r\n * selected cell. Again, this is way more complicated than\r\n * delete row case.\r\n */\r\n\r\n table.deleteColumn = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellXIndex = cell.dataset.xIndex,\r\n colspan = cell.colSpan;\r\n \r\n for ( let i = 0; i < colspan; i++ ) {\r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n let rowChildren = table.rows[j].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n } else {\r\n table.rows[j].removeChild( rowChildren[k] );\r\n }\r\n break;\r\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \r\n Number( rowChildren[k].dataset.xIndex ) + \r\n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n \r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n if (array[j] != undefined)\r\n array[j].pop();\r\n }\r\n \r\n maxAmountOfCells--;\r\n \r\n if( table.querySelectorAll( 'td' ).length == 0 ) {\r\n WPTB_Helper.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n \r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n }\r\n } else {\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n table.reconstraction();\r\n }\r\n }\r\n \r\n undoSelect();\r\n\r\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n\r\n array = fillTableArray();\r\n\r\n undoSelect();\r\n drawTable(array);\r\n\r\n wptbTableSetup.appendChild(table);\r\n //if (columns || rows) {\r\n table.recalculateIndexes( true );\r\n //}\r\n table.reconstraction();\r\n table.tdDefaultWidth();\r\n \r\n wptbTableSetup.onresize = function() {\r\n table.tdDefaultWidth();\r\n };\r\n\r\n WPTB_LeftPanel();\r\n\r\n // event hook to signal that table is generated and ready to be used\r\n WPTB_Helper.wptbDocumentEventGenerate('wptb:table:generated', document);\r\n\r\n WPTB_Helper.elementStartScript( table, 'table_setting' );\r\n WPTB_Helper.elementOptionsSet( 'table_setting', table );\r\n \r\n // this code gets the ID of the active element in the toolbar \r\n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\r\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\r\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\r\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\r\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\r\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\r\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\r\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\r\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\r\n// }\r\n// }\r\n// }, false );\r\n// }\r\n \r\n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\r\n// if( wptbPanelLeft.length > 0 ) {\r\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }, false );\r\n// }\r\n \r\n// let body = document.getElementsByTagName( 'body' );\r\n// if( body.length > 0 ) {\r\n// body[0].addEventListener( 'click', function( e ) {\r\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }\r\n// }, false );\r\n// }\r\n};","var WPTB_TableStateSaveManager = function() {\r\n this.tableStateSet = ( generate ) => {\r\n \r\n if( generate && window.wptbTableStateSaving && Array.isArray( window.wptbTableStateSaving ) ) {\r\n return;\r\n }\r\n \r\n // get table setup\r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\r\n let wptbPreviewTable = '';\r\n if( wptbTableSetup.length > 0 ) {\r\n wptbTableSetup = wptbTableSetup[0];\r\n\r\n wptbPreviewTable = wptbTableSetup.querySelector( '.wptb-preview-table' );\r\n } else {\r\n wptbTableSetup = '';\r\n }\r\n\r\n\r\n \r\n // check if a global array doesn't exist with saved versions of the table \r\n // them create it\r\n if( ! window.wptbTableStateSaving && ! Array.isArray( window.wptbTableStateSaving ) ) {\r\n window.wptbTableStateSaving = [];\r\n } \r\n\r\n // remove the extra part of the array after changing the table \r\n // when it is showed in the not last modified version\r\n if( window.wptbTableStateSaving.length > window.wptbTableStateNumberShow ) {\r\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\r\n }\r\n\r\n //add new state of table\r\n let wptbNewTableSetup = '';\r\n if( wptbTableSetup ) {\r\n wptbNewTableSetup = wptbTableSetup.cloneNode( true );\r\n let wptbHighlighted = wptbNewTableSetup.getElementsByClassName( 'wptb-highlighted' );\r\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\r\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n let wptbDirectlyhovered = wptbNewTableSetup.getElementsByClassName( 'wptb-directlyhovered' );\r\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\r\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\r\n }\r\n let mceContentBodys = wptbNewTableSetup.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 let dataMceStyle = wptbNewTableSetup.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 let mceIds = wptbNewTableSetup.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\r\n let cssForTdsWidthAutoValue = '';\r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAuto = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAuto ) {\r\n cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\r\n }\r\n }\r\n\r\n let wptbTableTitle = '';\r\n let wptbSetupName = document.getElementById( 'wptb-setup-name' );\r\n if( wptbSetupName ) wptbTableTitle = wptbSetupName.value;\r\n\r\n window.wptbTableStateSaving.push( [wptbNewTableSetup, cssForTdsWidthAutoValue, wptbTableTitle] );\r\n\r\n // set new number of state which is showed now\r\n window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\r\n\r\n // make undo arrow active when the table was changed\r\n if( window.wptbTableStateSaving.length - 1 > 0 ) {\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n\r\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\r\n }\r\n }\r\n\r\n // make redo arrow not active when the table was changed\r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n\r\n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\r\n }\r\n\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \r\n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave || ! wptbPreviewTable ) {\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n } else {\r\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.add('active');\r\n }\r\n }\r\n }\r\n \r\n this.tableStateGet = ( datawptbUndoredo ) => {\r\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 0 ) {\r\n \r\n // changes the number of the state which displays now\r\n if( datawptbUndoredo == 'undo' ) {\r\n if( window.wptbTableStateNumberShow > 0 ) {\r\n window.wptbTableStateNumberShow--;\r\n } else {\r\n return false;\r\n }\r\n } else if( datawptbUndoredo == 'redo' ) {\r\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length ) {\r\n window.wptbTableStateNumberShow++;\r\n } else {\r\n return false;\r\n }\r\n }\r\n \r\n // add or delete class \"wptb-undoredo-disabled\" for undo button\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n \r\n if( window.wptbTableStateNumberShow == 0 ) {\r\n if( wptbUndo ) {\r\n wptbUndo.classList.add( 'wptb-undoredo-disabled' );\r\n }\r\n } else if( window.wptbTableStateNumberShow > 0 ) {\r\n if( wptbUndo ) {\r\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\r\n }\r\n }\r\n }\r\n \r\n // add or delete class \"wptb-undoredo-disabled\" for redo button\r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n \r\n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\r\n if( wptbRedo ) {\r\n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\r\n }\r\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\r\n if( wptbRedo ) {\r\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' );\r\n }\r\n }\r\n }\r\n \r\n // add or delete class \"wptb-save-disabled\" for save button\r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \r\n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n } else {\r\n wptbSaveBtn.classList.add('active');\r\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\r\n }\r\n }\r\n \r\n // load necessary saved table state\r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\r\n if( wptbTableSetup.length > 0 ) {\r\n wptbTableSetup = wptbTableSetup[0];\r\n\r\n //wptbTableSetup.outerHTML = '';\r\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow] ) {\r\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] && \r\n typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] === 'object' ) {\r\n if( 'outerHTML' in window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] ) {\r\n wptbTableSetup.outerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][0].outerHTML;\r\n }\r\n }\r\n\r\n let wptbTableSetupNew = document.querySelector( '.wptb-table-setup' );\r\n if( wptbTableSetupNew && wptbTableSetupNew.children.length == 0 ) {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n wptbSaveBtn.classList.remove('active');\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n }\r\n\r\n // add or change or delete style element in the head for table cells who have auto width\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 if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\r\n let cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n\r\n // change value of table title field\r\n let wptbSetupName = document.getElementById( 'wptb-setup-name' );\r\n if( typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][2] != 'undefined' ) {\r\n if( wptbSetupName ) wptbSetupName.value = window.wptbTableStateSaving[window.wptbTableStateNumberShow][2];\r\n }\r\n }\r\n \r\n let body = document.getElementsByTagName( 'body' );\r\n if( body.length > 0 ) {\r\n body = body[0];\r\n }\r\n\r\n WPTB_Helper.elementOptionsPanelClear();\r\n WPTB_LeftPanel();\r\n\r\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \r\n if( wptbLeftScrollPanelCellSetting ) {\r\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\r\n }\r\n }\r\n }\r\n }\r\n \r\n this.tableStateClear = function() {\r\n delete window.wptbTableStateSaving;\r\n delete 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 \r\n wptbSaveBtn.removeAttribute( 'data-wptb-table-state-number-save' );\r\n }\r\n \r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n \r\n wptbUndo.classList.add( 'wptb-undoredo-disabled' );\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.classList.add( 'wptb-undoredo-disabled' );\r\n }\r\n }\r\n}"]}
|
1 |
+
{"version":3,"sources":["WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementObject.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Initializer.js","WPTB_LeftPanel.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Polyfills.js","WPTB_Responsive.js","WPTB_Settings.js","WPTB_Stringifier.js","WPTB_Table.js","WPTB_TableSettingsData.js","WPTB_TableStateSaveManager.js","WPTB_innerElementSet.js","applyGenericItemSettings.js"],"names":["WPTB_ActionsField","wptbActions","document","getElementsByClassName","length","addActionField","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","classList","remove","parentNode","removeChild","btnDelete","btnCopy","createElement","add","appendChild","type","onclick","event","act","target","el","infArr","className","match","hasOwnProperty","kind","thisRow","WPTB_Helper","rowIsTop","table","findAncestor","contains","dataTitleColumnSet","wptbActionsField","actionsRemove","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","wptbDocumentEventGenerate","copy","activeElement","activeElemParent","Array","isArray","data","elemProt","tinyMceClear","WPTB_ElementObject","insertBefore","getDOMElement","nextSibling","elementCopy","cloneNode","applyGenericItemSettings","WPTB_innerElementSet","setParameters","btnMove","draggable","ondragstart","wptbElementIconsDirectories","tmplIconsDirectories","wp","template","jsonIconsDirectories","IconsDirectories","JSON","parse","dragImages","getElementIcon","dataTransfer","effectAllowed","setDragImage","setData","style","display","actionsHide","ondragend","elementDragEndClear","coordinatesElement","getBoundingClientRect","wptbContainer","correctTop","top","parseFloat","removeEventListener","left","right","clientWidth","addEventListener","leaveFromField","node","relatedTarget","onmouseleave","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","responseText","getElementById","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","element","querySelector","dataset","wptbTableContainerMaxWidth","maxWidth","tdDefaultWidth","WPTB_Settings","send","counter","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","url","window","location","href","regex","RegExp","results","exec","WPTB_Cell","callback","DOMElement","highlightRow","td","parentRow","columnCount","parseInt","tds","i","classToAdd","ttd","highlightColumn","index","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","ondblclick","stopPropagation","currentTarget","newElementProxy","elementStartScript","wptbPhElement","wptbElementTypeClass","wptbTypeElementArr","split","wptbInternalActiveElement","j","wptbInternalActiveElementObj","setCoords","y","x","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","offsetWidth","height","offsetHeight","borderCollapse","tableFullStyleObj","tableBorderLeft","tableBorderRight","tableBorderTop","tableBorderBottom","nodeName","toLowerCase","firstChild","lastChild","WPTB_DropHandle","thisElem","e","hide","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","toPx","getDragRelativeType","cellRelatedDropHandle","range","createRange","setStart","shadowRoot","createContextualFragment","children","parentTd","getParentOfType","ondragenter","preventDefault","ondragover","ondragleave","ondrop","getData","wptbMovingMode","text","getDOMParentElement","innerElement","innerElementNext","undefined","onscroll","localName","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","increment","key","nextIndex","kindIndexProt","wpTemplateId","itemHtml","replace","trim","innerHTML","wptbElementMutch","elementClearFromTinyMce","inElems","querySelectorAll","inElemObj","WPTB_ElementOptions","elementOptionsSet","capture","hexToRgb","hex","result","rgbToHex","rgb","isHex","rgbm","Math","round","toString","toUpperCase","slice","test","icon_directory","hostName","protocol","hostname","img","src","wptbDropHandles","wptbDropBorderMarkers","linkHttpCheckChange","link","convertToAbs","currentLocation","origin","linkArr","linkClean","cls","parentElement","row","parent","getSelectionText","txt","getSelection","selection","elementOptionsPanelClear","elementOptionsGroup","wpColorPickerCheckChangeForTableStateSaving","originalEvent","wpPickerContainer","irisStripMouseUpStateSaveManager","wpColorPickerClear","attribute","isId","input","newInput","setAttribute","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","wpColorPickerChange","ui","uiColor","color","classe","ps","number","affectedEl","backgroundColor","ratingStar","span","fill","wptbTextMessageSize","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","ucfirst","str","charAt","eventName","details","CustomEvent","detail","bubbles","dispatchEvent","WPTB_ElementsScriptsLauncher","deleteEventHandlers","off","elementChildren","replaceAll","string","search","join","mceContentBodys","k","dataMceStyle","removeAttribute","mceEditFocus","contentEditable","spellCheck","mceIds","elementOptionContainerCustomClassSet","targetInput","customClassForContainer","containerElement","elementOptionContainerAdditionalStyles","containerAdditionalStyles","containerStylesArrOne","containerStylesSet","containerStyleStr","containerStyleStrArr","controlsInclude","functionHandler","acceptEventValues","controlConnectFunctionsName","name","elementKind","elementOptionsGroupIds","optionsGroupIds","elementOptionsGroupId","controlActiveElements","map","regularText","controlInfArr","controlActiveElement","controlUnicClassName","controls","controlName","control","targetControlValue","targetControlValueGet","targetValue","eventValue","push","oneControlInclude","wptbContrlStacksConfigId","tmplControlsConfig","container","jsonControlsConfigJson","jsonControlsConfig","controlClassName","innerElementCopyIncludeHandler","valueDependOnControl","dependOnControlName","targetControlElementClass","valueDependOnControlCorrect","dependOnControlDataGet","dependOnControlElementsArr","dependOnControlElements","valueDependOnControlCorrectObj","s","dependOnControlElementClass","dependOnControlData","Object","keys","forEach","unicClass","appearDependOnControl","dependOnMain","dependOnControlElementChangeHandler","controlContainerElem","dependOnControlElementsValue","dependOn","dependOnControlElementValue","showHideTargetControlElement","prototype","call","targetControlElement","dependOnControlElement","bind","controlsStateManager","targetControlClass","controlChangeIndic","targetControls","selectorElement","elementsSettingsTemplatesJs","elementSettings","elementsSettings","stringify","checked","alignmentValue","elementControlsStateCopy","elementProt","copyElem","infArrProt","infArrCopy","elemProtKind","elemCopyKind","elementsSettingsTemplateJs","elementSettingsProt","elementSettingsCopy","elementSettingValue","elementSettingKeyCopy","elementControlsStateDelete","nameControl","wptbElementDatas","elementContainerClass","elementOptionClassIndic","controlElementParent","elementOptionsScriptsContainer","cellEditActiveClass","activateSection","wptbelementOptionClass","childNodes","controlsConfigJson","controlsConfig","elementOptionsGroupIdsInvolved","elementOptionsGroupInvolved","elementOptionsContainerInvolved","controlScriptsObj","controlappearDependOnControl","controlValueDependOnControl","elementOptionsScriptsContainerIndic","controlsConfigNew","controlKey","tmplControlTemplate","elemContainer","elementControlTargetUnicClass","controlParamCalculateValue","controlTemplate","elementOptionsContainerInvolvedGet","elementOptionsContainer","elementOptionsGroupChildren","elementOptionsContainerOn","elementOptionContainerOn","elementOptionContainer","elementOptionClass","controlContainerElemParent","helperJavascriptElem","helperJavascriptCode","innerText","script","controlScriptsArr","id","unicClassP","controlParamCalculateValueCreateFunction","handlerFunction","managerExternalCssStyles","elementContainer","selector","cssName","cssValue","head","cssForThisElement","cssText","cssTextArrFirst","pop","selectorExists","cssTextArrSecond","cssTextArrThird","cssNameExists","cssTextArrFourth","splice","registerSections","sections","currentSection","sectionElement","sectionDataId","displayType","triggerSectionEvent","visibility","getCurrentSection","getSectionFromUrl","parsedUrl","URL","urlSection","searchParams","get","some","setupSectionButtons","sectionButtons","from","vm","sectionName","wptbSectionButton","wptbSectionDisplayType","setupPanelToggleButtons","$","each","find","click","slideToggle","toggleClass","sectionEvent","setupSidebarToggle","toggleSelector","toggleButton","toggle","externalCssStylesDelete","externalCssStylesCopy","copyElement","activeElemClass","cssForActiveElement","cssForNewElement","infArrCopyEl","cssForActiveElementInnerHTML","cssForNewElementInnerHTML","elementsStylesConvertToObject","stylesElements","stylesObj","styleElemId","getAttribute","elementsStylesSetFromObject","jsonObject","styleCss","saveTable","startSaving","previewSaving","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","toggleTableEditMode","wptb_admin_object","t","messagingArea","code","datas","postId","rs","wptbId","paramIdsNecessaryChange","codeClone","wptbTableSetup","columns","WPTB_Stringifier","outerHTML","datas_containers","styleObjJson","messagingAreaText","setTimeout","params","title","content","elements_datas","elements_styles","security_code","preview_saving","action","builderPageUrl","history","pushState","wptbPreviewTable","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","clickOnFreeSpace","cellModeBackground","wpcdFixedToolbar","hasAttribute","elementAjax","dataAjaxData","element_name","element_ajax_data","close","leftScrollPanelCurtain","leftScrollPanelCellSettings","toggleEditMode","deactivateMultipleSelectMode","wptbPreviewTableTds","activateMultipleSelectMode","checkingDimensionValue","dimension","searchIndex","checkSetGetStyleSizeValue","styleName","computedStyleName","elemStyleValue","elementStyles","checkSetGetStyleColorValue","set","elemStyleColorValue","checkSetGetStyleValue","getValueMaxCountSameElementsInArray","arr","check","countEmpty","maxPropName","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","colSpan","rowSpan","z","tableRowsColorsReinstall","tableIndex","tableHeaderBackground","tableEvenRowBackground","tableOddRowBackground","parentType","dragRelativeType","setDragRelativeType","getElementColorStylesHex","showControlsOnElementMount","showElementsListOnRemove","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","rows","WptbResponsive","WPTB_LeftPanel","wptbElementButtons","wptbElement","wptbTablesEditModeCloseButton","wptbBuilderPanel","wptbHeader","selectedCells","multipleCellMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","first","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","div","columnTitleMobile","hasDontEnumBug","propertyIsEnumerable","dontEnums","dontEnumsLength","obj","TypeError","prop","responsiveWrapperId","mainContainerQuery","responsiveTable","loaded","addContainerToDom","responsiveContainer","mainContainer","Error","responsiveElement","load","WPTB_ControlsManager","callControlScript","startUp","tablePreview","elems","wptbRelativeElements","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","previewId","floor","random","newHref","tableTitleField","onchange","codeMain","tableColumns","minWidth","innerElements","wptbActionsLength","dataMceBogus","array","wptb_preview_table","maxAmountOfCells","maxAmountOfRows","mark","cs","noCells","singleCells","multipleCells","cellSettings","position","column","cellHighlighted","markedCells","controlElemIds","elementControlSizeUnicClass","elementControlSizeFixedUnicClass","sizeName","getSizeFunctionName","size","cellSizeInputs","cellSizeFixedInput","isSquare","settingId","settingElem","countMarkedCells","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","a","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","max","apply","getActualPointsInRow","points","skipInCols","reconstraction","insertRow","borderWidth","setMaxAmountOfCells","getMaxAmountOfCells","addColumnWidth","cleaner","highlighted","dataXIndex","tableTdsFor","colspan","tableRows","widthIsSet","arrayTdsFromPreviousRow","wptbFixedWidth","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTdWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","cssForTdsWidthAutoOld","wptbTableAlignment","float","addRowHeight","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","wptbFixedHeight","mergingCellsVertically","forBreak","addColumnEnd","currentTable","currentTableTd","currentTdStyle","borderColor","WPTB_TableSettingsData","getTableSetting","addColumnStart","firstCell","addColumnAfter","c_pos","cellStyle","pos","newTd","nextSib","addColumnBefore","addRowToTheEnd","r","aux","addRowToTheStart","addRowBefore","cellNew","rowChildren","rowChildrenLength","addRowAfter","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","mergeCells","dimensions","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","p","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","splitCell","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","Number","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","deleteRow","thisRowChildren","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","deleteColumn","onresize","setTableSetting","generate","wptbTableStateSaving","wptbNewTableSetup","wptbHighlighted","wptbDirectlyhovered","cssForTdsWidthAutoValue","wptbTableTitle","wptbSetupName","datawptbUndoredo","wptbTableSetupNew","wptbLeftScrollPanelCellSetting","tableStateClear","classId","parentCell","elemKind","onmouseover","wptbElements","elementIndexesArr","elementIndexMax","wptbNodeattributes","attributes","attr","newDataAttributeName","newDataAttributeValue","nodeValue","kindIndexProtArr","node_wptb_element_kind_num","onmouseenter"],"mappings":";;AAAA,IAAIA,oBAAoB,SAApBA,iBAAoB,GAAW;AAAA;;AAC/B;AACA,SAAKC,WAAL;AACA,QAAIC,SAASC,sBAAT,CAAiC,cAAjC,EAAkDC,MAAlD,IAA4D,CAAhE,EAAoE;AAChE,aAAKH,WAAL,GAAmBC,SAASC,sBAAT,CAAiC,cAAjC,EAAkD,CAAlD,CAAnB;AACH;;AAED,SAAKE,cAAL,GAAsB,UAAEC,UAAF,EAAcC,QAAd,EAA4B;AAC9C,YAAIC,OAAON,SAASO,oBAAT,CAA+B,MAA/B,EAAwC,CAAxC,CAAX;;AAEA,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,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L,CAAeC,MAAf,CAAuB,kBAAvB;AACH,KAZD;;AAcAmF,SAAKE,YAAL,GAAoB,UAAW3E,KAAX,EAAmB;AACnC,YAAIgB,mBAAmB,IAAIxC,iBAAJ,EAAvB;;AAEAwC,yBAAiBwD,cAAjB,CAAiCxE,KAAjC,EAAwCyE,IAAxC;AACH,KAJD;AAKH,CApFD","file":"admin.js","sourcesContent":["var WPTB_ActionsField = function() {\n //this.wptbBorderMarker;\n this.wptbActions;\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n \n this.addActionField = ( actionType, thisNode ) => {\n let body = document.getElementsByTagName( 'body' )[0];\n \n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length != 0 ) {\n let previousNode = actions[0].activeElem;\n if( previousNode ) {\n previousNode.classList.remove( 'wptb-directlyhovered' );\n }\n \n while( actions.length != 0 ) {\n actions[0].parentNode.removeChild( actions[0] );\n }\n }\n \n if( actionType == 1 ) {\n \n let btnDelete, btnCopy;\n\n btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n actions = document.createElement( 'div' );\n\n actions.classList.add( 'wptb-actions' );\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\n \n actions.appendChild( btnCopy );\n actions.appendChild( btnDelete );\n \n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n\n actions.type = 1;\n\n btnDelete.onclick = function( event ) {\n let act = event.target.parentNode.activeElem,\n el = act.parentNode;\n let infArr = act.className.match( /wptb-element-(.+)-(\\d+)/i );\n// if( act && infArr && Array.isArray( infArr ) ) {\n// WPTB_Helper.elementControlsStateDelete( act );\n// WPTB_Helper.externalCssStylesDelete( infArr[0] );\n// }\n \n if( act ) {\n el.removeChild( act );\n }\n\n if( act && typeof act === 'object' && act.hasOwnProperty( 'kind' ) && act.kind == 'text' ) {\n let thisRow = el.parentNode;\n \n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n }\n\n let wptbActionsField = new WPTB_ActionsField();\n wptbActionsField.actionsRemove();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n\n WPTB_Helper.wptbDocumentEventGenerate('element:removed:dom', document, act);\n };\n\n btnCopy.onclick = ( event ) => {\n let copy,\n infArr,\n type;\n let activeElement = event.target.parentNode.activeElem;\n let activeElemParent = activeElement.parentNode;\n infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n type = infArr[1];\n let data = {};\n data.kind = type;\n data.elemProt = activeElement;\n data.tinyMceClear = true;\n copy = new WPTB_ElementObject( data );\n //WPTB_Helper.elementControlsStateCopy( activeElement, copy.getDOMElement() );\n //WPTB_Helper.externalCssStylesCopy( activeElement, copy.getDOMElement() );\n //WPTB_Helper.elementStartScript( copy.getDOMElement() );\n \n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else {\n copy = {};\n let elementCopy = activeElement.cloneNode( true );\n elementCopy.classList.remove( 'wptb-directlyhovered' );\n \n copy.getDOMElement = function() {\n return elementCopy;\n }\n \n applyGenericItemSettings( copy );\n \n activeElemParent.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n \n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-inner-element:copy', activeElement, copy.getDOMElement() );\n }\n \n WPTB_innerElementSet( copy.getDOMElement() );\n\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\n wptbActionsField.setParameters( activeElement );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n \n \n if( thisNode.classList.contains( 'wptb-ph-element' ) ) {\n let btnMove;\n btnMove = document.createElement( 'span' );\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\n btnMove.draggable = true;\n actions.appendChild( btnMove );\n \n btnMove.ondragstart = ( event ) => {\n let wptbElementIconsDirectories = 'wptb-element-icons-directories';\n let tmplIconsDirectories = wp.template( wptbElementIconsDirectories );\n let data = {};\n let jsonIconsDirectories = tmplIconsDirectories( data );\n let IconsDirectories = JSON.parse( jsonIconsDirectories );\n\n let dragImages,\n actions = event.target.parentNode,\n activeElem = actions.activeElem,\n infArr,\n type;\n infArr = activeElem.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n type = infArr[1];\n activeElem.classList.add( 'wptb-moving-mode' );\n\n if( IconsDirectories && typeof IconsDirectories === 'object' && IconsDirectories[type] ) {\n dragImages = WPTB_Helper.getElementIcon( IconsDirectories[type] );\n }\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage( dragImages, 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.activeElem;\n if( act.kind == 'text' ) {\n let thisRow = act.parentNode.parentNode;\n \n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n }\n } else {\n this.style.display = 'none';\n }\n\n this.actionsHide();\n };\n\n btnMove.ondragend = ( event ) => {\n WPTB_Helper.elementDragEndClear();\n }\n }\n\n actions.style.display = 'flex';\n\n this.wptbActions = actions;\n } \n }\n \n this.setParameters = ( thisNode ) => {\n \n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n } else {\n this.wptbActions = false;\n }\n }\n \n if( this.wptbActions && this.wptbActions.classList.contains( 'wptb-actions' ) ) {\n this.wptbActions.style.display = 'flex';\n } else {\n return;\n }\n \n let coordinatesElement = thisNode.getBoundingClientRect();\n \n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\n let correctTop = () => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n }\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\n \n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\n \n this.wptbActions.style.display = 'flex';\n thisNode.classList.add( 'wptb-directlyhovered' );\n \n wptbContainer.addEventListener( 'scroll', correctTop, false );\n }\n \n this.leaveFromField = ( event, node, actionType ) => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n } else {\n this.wptbActions = false;\n }\n }\n \n if( ! this.wptbActions ) {\n return;\n }\n \n if( event.relatedTarget ) {\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\n if( ! this.wptbActions ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n this.wptbActions.onmouseleave = ( event ) => {\n if( event.relatedTarget != null && ( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || \n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element') ) && event.relatedTarget != this.wptbActions.activeElem &&\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered' ) != this.wptbActions.activeElem ) {\n \n// this.wptbActions.style.display = 'none';\n// event.relatedTarget.parentNode.parentNode.classList.remove( 'wptb-directlyhovered' );\n//\n// let wptbActionsField = new WPTB_ActionsField();\n//\n// wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\n//\n// wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\n } else {\n \n }\n \n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.leaveFromField( event, event.relatedTarget.parentNode.parentNode );\n \n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\n }\n\n return;\n } \n }\n \n node.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n \n if( event.relatedTarget ) {\n if( event.relatedTarget.classList.contains( 'wptb-ph-element' ) || WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-ph-element' ) ) {\n this.addActionField( 1, event.relatedTarget.parentNode );\n\n this.setParameters( event.relatedTarget.parentNode );\n }\n }\n }\n \n this.actionsRemove = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.parentNode.removeChild( this.wptbActions );\n }\n }\n \n this.actionsHide = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.opacity = 0;\n }\n }\n}","(function () {\n var WPTB_Builder = function () {\n var table_id = WPTB_Helper.detectMode();\n if ( table_id ) {\n var http = new XMLHttpRequest(),\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\n http.open('GET', urlSet, true);\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n http.onreadystatechange = function (d) {\n if (this.readyState == 4 && this.status == 200) {\n var ans = JSON.parse( http.responseText );\n document.getElementById('wptb-setup-name').value = ans[0];\n \n if( ans[1] ) {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\n \n let body = document.getElementsByTagName('body')[0];\n \n WPTB_Table();\n let element = document.querySelector( '.wptb-preview-table' );\n if( element ) {\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n if( ! infArr ) {\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\n }\n \n if( element.dataset.wptbTableContainerMaxWidth ) {\n wptbTableSetupEl.style.maxWidth = element.dataset.wptbTableContainerMaxWidth + 'px';\n \n element.tdDefaultWidth();\n }\n }\n \n //WPTB_LeftPanel();\n WPTB_Settings();\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n }\n \n return;\n }\n };\n http.send(null);\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n document.counter = new ElementCounters();\n document.select = new MultipleSelect();\n\n var initializer = WPTB_Initializer();\n settings = WPTB_Settings();\n };\n\n let url = window.location.href,\n regex = new RegExp('[?&]page=wptb-builder'),\n results = regex.exec( url );\n if ( results ) {\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\n }\n})();","var WPTB_Cell = function ( callback, DOMElement ) {\n\n function highlightRow(td) {\n var parentRow = td.parentNode,\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\n }\n for (var i = 0; i < columnCount; i++) {\n\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\n var ttd = parentRow.getElementsByTagName('td')[i];\n if (ttd !== td) {\n ttd.classList.add(classToAdd);\n }\n }\n }\n\n function highlightColumn(td) {\n\n var index,\n parentRow = td.parentNode;\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\n for (var i = 0; i < columnCount; i++) {\n if (parentRow.getElementsByTagName('td')[i] === td) {\n index = i;\n break;\n }\n }\n\n for (var i = 0; i < rowCount; i++) {\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\n var tr = table.getElementsByTagName('tr')[i];\n if (tr.getElementsByTagName('td')[index] !== td) {\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\n }\n }\n }\n \n if( ! DOMElement ) {\n DOMElement = document.createElement(\"td\");\n\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\n\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\n\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\n } \n\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\n }\n\n DOMElement.draggable = false;\n if ( callback ) {\n DOMElement.onclick = callback;\n }\n \n // Cell double click handler\n DOMElement.ondblclick = function( event ) {\n event.stopPropagation();\n if( ! WPTB_Helper.findAncestor( DOMElement, 'wptb-preview-table-manage-cells' ) && event.target == event.currentTarget ) {\n \n WPTB_Helper.wptbDocumentEventGenerate( 'table:cell:dblclick', event.target );\n \n let element = WPTB_Helper.newElementProxy( 'text' );\n element = element.getDOMElement();\n \n DOMElement.appendChild( element );\n \n WPTB_innerElementSet( element );\n }\n }\n \n WPTB_innerElementSet( DOMElement );\n\n WPTB_Helper.elementStartScript( DOMElement, 'table_cell_setting' );\n\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\n \n if ( wptbPhElement.length > 0 ) {\n for( let i = 0; i < wptbPhElement.length; i++ ) {\n wptbPhElement[i].getDOMElement = function() {\n return wptbPhElement[i];\n }\n \n WPTB_innerElementSet( wptbPhElement[i] );\n \n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\n wptbPhElement[i].kind = wptbTypeElementArr[0];\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\n let wptbInternalActiveElement = wptbPhElement[i].getElementsByClassName( 'wptb-in-element' );\n if ( wptbInternalActiveElement.length > 0 ) {\n for ( let j = 0; j < wptbInternalActiveElement.length; j++ ) {\n let wptbInternalActiveElementObj = {};\n wptbInternalActiveElementObj.getDOMElement = function() {\n return wptbInternalActiveElement[j];\n }\n \n applyGenericItemSettings( wptbInternalActiveElementObj );\n }\n }\n }\n }\n }\n\n this.getDOMElement = function () {\n return DOMElement;\n };\n\n this.setCoords = function (y, x) {\n var el = this.getDOMElement();\n el.dataset.yIndex = y;\n el.dataset.xIndex = x;\n };\n\n this.getCoords = function () {\n var coords,\n el = this.getDOMElement();\n coords.x = el.dataset.xIndex;\n coords.y = el.dataset.yIndex;\n return coords;\n };\n\n this.appendElement = function (node) {\n getDOMElement().appendChild(node);\n };\n \n DOMElement.getCellDimensions = function() {\n\n let tdStyleObj = window.getComputedStyle( this, null );\n\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\n\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\n\n let width = parseInt( this.offsetWidth, 10 ) -\n parseInt( tdPaddingLeft, 10 ) -\n parseInt( tdPaddingRight, 10 );\n\n let height = parseInt( this.offsetHeight, 10 ) -\n parseInt( tdPaddingTop, 10 ) -\n parseInt( tdPaddingBottom, 10 );\n let table = WPTB_Helper.findAncestor( this, 'wptb-preview-table' );\n if(table) {\n if(table.style.borderCollapse === 'collapse') {\n width = width - ( parseInt( tdBorderLeftWidth, 10 ) / 2 ) -\n ( parseInt( tdBorderRightWidth, 10 ) / 2 );\n height = height - ( parseInt( tdBorderTopWidth, 10 ) / 2 ) -\n ( parseInt( tdBorderBottomWidth, 10 ) / 2 );\n let tableFullStyleObj = window.getComputedStyle( table, null );\n let tableBorderLeft = tableFullStyleObj.getPropertyValue( 'border-left-width' );\n let tableBorderRight = tableFullStyleObj.getPropertyValue( 'border-right-width' );\n let tableBorderTop = tableFullStyleObj.getPropertyValue( 'border-top-width' );\n let tableBorderBottom = tableFullStyleObj.getPropertyValue( 'border-bottom-width' );\n\n let tr = this.parentNode;\n if( tr && tr.nodeName.toLowerCase() === 'tr' ) {\n if( tr.firstChild && tr.firstChild.dataset.xIndex === this.dataset.xIndex ) {\n if( parseInt( tableBorderLeft, 10 ) > parseInt( tdBorderLeftWidth, 10 ) ) {\n width += -( parseInt( tableBorderLeft, 10 ) - parseInt( tdBorderLeftWidth, 10 ) ) / 2;\n }\n }\n\n if( tr.lastChild && tr.lastChild.dataset.xIndex === this.dataset.xIndex ) {\n if( parseInt( tableBorderRight, 10 ) > parseInt( tdBorderRightWidth, 10 ) ) {\n width += -( parseInt( tableBorderRight, 10 ) - parseInt( tdBorderRightWidth, 10 ) ) / 2;\n }\n }\n\n let body = tr.parentNode;\n if( body && body.nodeName.toLowerCase() === 'body' ) {\n if( body.firstChild && body.firstChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\n if( parseInt( tableBorderTop, 10 ) > parseInt( tdBorderTopWidth, 10 ) ) {\n height += ( parseInt( tableBorderTop, 10 ) - parseInt( tdBorderTopWidth, 10 ) ) / 2;\n }\n }\n\n if( body.lastChild && body.lastChild.firstChild.dataset.yIndex === this.dataset.yIndex ) {\n if( parseInt( tableBorderBottom, 10 ) > parseInt( tdBorderBottomWidth, 10 ) ) {\n height += ( parseInt( tableBorderBottom, 10 ) - parseInt( tdBorderBottomWidth, 10 ) ) / 2;\n }\n }\n }\n }\n } else if(table.style.borderCollapse === 'separate') {\n width = width - parseInt( tdBorderLeftWidth, 10 ) -\n parseInt( tdBorderRightWidth, 10 );\n height = height - parseInt( tdBorderTopWidth, 10 ) -\n parseInt( tdBorderBottomWidth, 10 );\n }\n }\n\n return {\n width: parseInt( width ),\n height: parseInt( height )\n };\n }\n\n return this;\n};","var WPTB_DropHandle = function (thisElem, e, hide = false) {\n\n let wptbDropHandle,\n wptbDropBorderMarker,\n wptbDropBorderMarkerTop,\n wptbDropBorderMarkerRight,\n wptbDropBorderMarkerBottom,\n wptbDropBorderMarkerLeft;\n\n /**\n * Add px suffix to a value\n *\n * @param {any} val value\n * @returns {string} string value suffixed with px\n */\n function toPx(val){\n return `${val}px`;\n }\n\n if(WPTB_Helper.getDragRelativeType() === 'td_relative'){\n let cellRelatedDropHandle = document.querySelector('.wptb-cell-related-drop-handle');\n if(hide && cellRelatedDropHandle ){\n cellRelatedDropHandle.style.display = 'none';\n return;\n }\n if(cellRelatedDropHandle === null){\n const range = document.createRange();\n range.setStart(document.body , 0);\n\n const shadowRoot = range.createContextualFragment('<div class=\"wptb-cell-related-drop-handle\">Add to cell</div>').children[0];\n\n document.body.appendChild(shadowRoot);\n cellRelatedDropHandle = shadowRoot.children[0];\n }\n\n const parentTd = WPTB_Helper.getParentOfType('td', thisElem);\n const {top,left,width,height} = parentTd.getBoundingClientRect();\n\n if(!cellRelatedDropHandle){\n return;\n }\n\n cellRelatedDropHandle.style.display = 'flex';\n cellRelatedDropHandle.style.top = toPx(top);\n cellRelatedDropHandle.style.width = toPx(width);\n cellRelatedDropHandle.style.height = toPx(height);\n cellRelatedDropHandle.style.left = toPx(left);\n\n return;\n }\n\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\n wptbDropHandle = document.createElement( 'div' );\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\n \n wptbDropBorderMarker = document.createElement( 'div' );\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\n \n wptbDropBorderMarkerTop = document.createElement( 'div' ),\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\n \n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\n \n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\n \n let body = document.getElementsByTagName( 'body' );\n if ( body.length > 0 ) {\n body[0].appendChild( wptbDropHandle );\n body[0].appendChild( wptbDropBorderMarker );\n }\n \n wptbDropHandle.ondragenter = function () {\n if (e.target.classList.contains('wptb-empty')) {\n e.preventDefault();\n return false;\n }\n }\n\n wptbDropHandle.ondragover = function (e) {\n e.preventDefault(); \n }\n\n wptbDropHandle.ondragleave = function () {\n\n }\n wptbDropHandle.ondrop = function (e) {\n e.preventDefault();\n let element;\n \n if ( e.dataTransfer.getData('wptbElement') ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData('wptbElement') );\n element = element.getDOMElement();\n } else {\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\n element.classList.remove( 'wptb-moving-mode' );\n element.classList.remove( 'wptb-moving-into-same-elem' );\n element.wptbMovingMode = 1;\n }\n \n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n thisElem = wptbDropHandle.getDOMParentElement();\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n }\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n \n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n }\n }\n \n let thisRow = td.parentNode;\n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n\n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n \n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n \n WPTB_innerElementSet( element );\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n element.wptbMovingMode == undefined;\n }\n }\n let wptbContainer = document.querySelector( '.wptb-container' );\n wptbContainer.onscroll = function() {\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n } else {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0) {\n return;\n }\n\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \n thisElem.classList.contains('wptb-empty')) {\n return;\n }\n \n let thisRow;\n if ( thisElem.localName == 'td' ) {\n thisRow = thisElem.parentNode;\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\n thisRow = thisElem.parentNode.parentNode;\n }\n \n if( WPTB_Helper.rowIsTop( thisRow ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n \n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n let indics = e.dataTransfer.types;\n let notDragEnter = false;\n for ( let i = 0; i < indics.length; i++ ) {\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\n if ( infArr && infArr[1] != 'text' ) {\n notDragEnter = true;\n break;\n }\n }\n if( notDragEnter ) {\n return;\n }\n }\n }\n \n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\n let height = thisElem.offsetHeight,\n coordinatesElement = thisElem.getBoundingClientRect(),\n left = parseFloat( coordinatesElement.left ),\n top;\n wptbDropHandle.style.left = left + 'px';\n \n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\n if( thisElem == elementDrag ) {\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\n } else {\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\n }\n }\n \n wptbDropHandle.getDOMParentElement = function() {\n return thisElem;\n }\n \n wptbDropHandle.style.display = 'block';\n wptbDropBorderMarker.style.display = 'block';\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\n wptbDropHandle.dataset.text = 'Above Element';\n if ( y > height/2 ) {\n top = parseFloat( coordinatesElement.top ) + height - 1;\n wptbDropHandle.dataset.text = 'Below Element';\n }\n } else {\n wptbDropHandle.dataset.text = 'Drop Here';\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\n }\n wptbDropHandle.style.top = top + 'px';\n\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\n\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\n\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\n\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\n\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\n}","var ElementCounters = function () {\n\n\tvar priv = [];\n\tpriv['text'] = 0;\n\tpriv['image'] = 0;\n\tpriv['list'] = 0;\n\tpriv['button'] = 0;\n\n\tthis.increment = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn;\n\t\t}\n\t\tpriv[key]++;\n\t}\n\n\tthis.nextIndex = function (key) {\n\t\tif (!(key in priv)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn priv[key] + 1;\n\t}\n\n\treturn this;\n\n};","var WPTB_ElementObject = function ( data ) {\n let DOMElement, kindIndexProt, copy;\n if( ! data.elemProt ) {\n DOMElement = document.createElement('div'),\n kindIndexProt = undefined,\n copy = false;\n DOMElement.classList.add( 'wptb-' + data.kind + '-container', 'wptb-ph-element' );\n \n let wpTemplateId = 'wptb-' + data.kind + '-content';\n let template = wp.template( wpTemplateId );\n data.node = DOMElement;\n let itemHtml = template( data );\n\n itemHtml = itemHtml.replace(/\\r|\\n|\\t/g, '').trim();\n DOMElement.innerHTML = itemHtml;\n } else {\n DOMElement = data.elemProt.cloneNode( true );\n DOMElement.classList.remove( 'wptb-directlyhovered' );\n let wptbElementMutch = data.elemProt.className.match( /wptb-element-((.+-)\\d+)/i );\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\n kindIndexProt = wptbElementMutch[1];\n };\n copy = true;\n \n if( data.tinyMceClear ) {\n DOMElement = WPTB_Helper.elementClearFromTinyMce( DOMElement );\n }\n }\n \n let inElems = DOMElement.querySelectorAll( '.wptb-in-element' );\n if( inElems.length > 0 ) {\n for ( let i = 0; i < inElems.length; i++ ) {\n let inElemObj = {};\n inElemObj.getDOMElement = function() {\n return inElems[i];\n }\n \n applyGenericItemSettings( inElemObj );\n }\n }\n \n window.addEventListener( 'item:onmouseenter', function( event ) {\n //console.log( event );\n }, false);\n \n \n this.kind = data.kind;\n this.getDOMElement = function () {\n return DOMElement;\n };\n \n applyGenericItemSettings( this, kindIndexProt, copy );\n return this;\n}\n\n\n","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\n\n var node = element.getDOMElement();\n node.addEventListener( 'click', function() {\n WPTB_Helper.elementOptionsSet( element.kind, this );\n }, {capture: true} );\n};","var WPTB_Helper = {\n hexToRgb: function( hex ) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\n },\n rgbToHex: function ( rgb ) {\n if( rgb ) {\n if( WPTB_Helper.isHex( rgb ) ) return rgb;\n\n let rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?((?:[0-9]*[.])?[0-9]+)[\\s+]?\\)/i);\n if ( rgbm && rgbm.length === 5) {\n return \"#\" +\n ('0' + Math.round(parseFloat(rgbm[4], 10) * 255).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\n } else {\n rgbm = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n if (rgbm && rgbm.length === 4) {\n return \"#\" +\n (\"0\" + parseInt(rgbm[1], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[2], 10).toString(16).toUpperCase()).slice(-2) +\n (\"0\" + parseInt(rgbm[3], 10).toString(16).toUpperCase()).slice(-2);\n } else {\n return '';\n }\n }\n } else {\n return '';\n }\n\n },\n isHex: function( hex ) {\n let regex = new RegExp('^#(?:[A-Fa-f0-9]{3}){1,2}$');\n return regex.test( hex );\n },\n getElementIcon: function ( icon_directory ) {\n let hostName = location.protocol + '//' + location.hostname;\n let img = document.createElement( 'img' );\n img.src = icon_directory;\n return img;\n },\n elementDragEndClear: function() {\n let wptbMovingMode = document.getElementsByClassName( 'wptb-moving-mode' );\n if ( wptbMovingMode.length > 0 ) {\n for( let i = 0; i < wptbMovingMode.length; i++ ) {\n wptbMovingMode[i].classList.remove( 'wptb-moving-mode' );\n }\n }\n\n let wptbDropHandles = document.getElementsByClassName( 'wptb-drop-handle' );\n if ( wptbDropHandles.length > 0 ) {\n for( let i = 0; i < wptbDropHandles.length; i++ ) {\n wptbDropHandles[i].style.display = 'none';\n }\n }\n\n let wptbDropBorderMarkers = document.getElementsByClassName( 'wptb-drop-border-marker' );\n if ( wptbDropBorderMarkers.length > 0 ) {\n for( let i = 0; i < wptbDropBorderMarkers.length; i++ ) {\n wptbDropBorderMarkers[i].style.display = 'none';\n }\n }\n },\n linkHttpCheckChange: function( link, convertToAbs = false ) {\n if ( link ) {\n // even though it is not a best practice and a huge security risk, sometimes our users use javascript tag at href attributes, this check will make sure those tags will not be modified and returned as they are\n if(link.match(/^(javascript:)(.+)$/)){\n return link;\n }\n // relative link checking\n // if link starts with '/', assume it is a relative link to the origin of the current site\n else if( link.match(/^\\/([\\S]+)$/) ){\n if (convertToAbs) {\n const currentLocation = document.location;\n let {origin} = currentLocation;\n\n\n // strip out the '/' at the end of the origin name if there is any\n if (origin.match(/^(.+)\\/$/)) {\n origin = origin.slice(-1);\n }\n\n return `${origin}${link}`;\n }else{\n return link;\n }\n }\n else if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\n let linkArr = link.split( '/' ),\n linkClean;\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\n linkClean = linkArr[linkArr.length - 1];\n }\n return document.location.protocol + '//' + linkClean;\n } else {\n return link;\n }\n } else {\n return '';\n }\n },\n dataTitleColumnSet: function( table ) {\n // TODO dataTitleColumnSet\n // let rows = table.rows,\n // rowHead = rows[0];\n // let computedStyleRowHead = getComputedStyle( rowHead );\n //\n // let rowHeadChildren = rowHead.children;\n // let contentsForHeader = {};\n // for( let i = 0; i < rowHeadChildren.length; i++ ) {\n // let tdElements = rowHeadChildren[i].children;\n //\n // for( let j = 0; j < tdElements.length; j++ ) {\n // let element = tdElements[j];\n // if( element.classList.contains( 'wptb-ph-element' ) ) {\n // let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n // if( infArr[1] == 'text' ) {\n // let p = element.querySelector( 'p' ),\n // textContent = p.textContent,\n // textAlign = p.style.textAlign;\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize,\n // element.style.color, computedStyleRowHead.backgroundColor, textAlign];\n // break;\n // }\n // }\n // }\n // if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\n // contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '',\n // '', computedStyleRowHead.backgroundColor, ''];\n // }\n // }\n // for ( let i = 1; i < rows.length; i++ ) {\n // let thisRow = rows[i],\n // thisRowChildren = thisRow.children;\n // for( let j = 0; j < thisRowChildren.length; j++ ) {\n // if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\n // thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\n // thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\n // thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\n // } else {\n // thisRowChildren[j].dataset.wptbTitleColumn = null;\n // thisRowChildren[j].dataset.wptbTitleColumnFontSize = null;\n // thisRowChildren[j].dataset.wptbTitleColumnColor = null;\n // thisRowChildren[j].dataset.wptbTitleBackgroundColor = null;\n // thisRowChildren[j].dataset.wptbTitleAlign = null;\n // }\n // }\n // }\n },\n findAncestor: function( el, cls ) {\n while ( ( el = el.parentElement ) && !el.classList.contains( cls ) );\n return el;\n },\n rowIsTop: function( row ) {\n var parent = row.parentNode;\n if( parent.children[0] == row ) {\n return true;\n } else {\n return false;\n }\n },\n getSelectionText: function() {\n var txt = '';\n if (txt = window.getSelection) {\n txt = window.getSelection().toString();\n } else {\n txt = document.selection.createRange().text;\n }\n return txt;\n },\n elementOptionsPanelClear: function() {\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\n if( elementOptionsGroup ) {\n elementOptionsGroup.innerHTML = '';\n }\n },\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\n if( event.originalEvent.type == 'external' ) {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } else {\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\n if( wpPickerContainer ) {\n if( event.originalEvent.type == 'square' || event.originalEvent.type == 'strip' ) {\n let body = document.getElementsByTagName( 'body' )[0];\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\n body.addEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\n }\n }\n }\n },\n irisStripMouseUpStateSaveManager: function() {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n\n let body = document.getElementsByTagName( 'body' )[0];\n body.removeEventListener( 'mouseup', WPTB_Helper.irisStripMouseUpStateSaveManager, false );\n },\n wpColorPickerClear: function( attribute, isId ) {\n let input;\n if( isId ) {\n input = [document.getElementById( attribute )];\n input.length = 1;\n } else {\n input = document.getElementsByClassName( attribute );\n }\n for( let i = 0; i < input.length; i++ ) {\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\n if( wpPickerContainer ) {\n let parent = wpPickerContainer.parentNode;\n parent.removeChild( wpPickerContainer );\n let newInput = document.createElement( 'input' );\n if( isId ) {\n newInput.setAttribute( 'id', attribute );\n } else {\n newInput.classList.add( 'wptb-element-property', attribute );\n }\n newInput.value = \"\";\n parent.appendChild( newInput );\n }\n }\n },\n detectMode: function() {\n var url = window.location.href,\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\n results = regex.exec(url);\n if ( ! results ) return false;\n if ( ! results[2] ) return '';\n return decodeURIComponent( results[2].replace(/\\+/g, ' ') );\n },\n getColumnWidth: function( table, cell ) {\n let xIndex = cell.dataset.xIndex;\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\n let cellWidth = cell.getCellDimensions().width;\n for( let i = 0; i < xIndexes.length; i++ ) {\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\n cellWidth = xIndexes[i].getCellDimensions().width;\n }\n }\n return cellWidth;\n },\n getRowHeight: function( table, cell ) {\n let yIndex = cell.dataset.yIndex;\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\n let cellHeight = cell.getCellDimensions().height;\n for( let i = 0; i < yIndexes.length; i++ ) {\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\n cellHeight = yIndexes[i].getCellDimensions().height;\n }\n }\n return cellHeight;\n },\n newElementProxy: function( el ) {\n if( el ) {\n let data = {kind: el};\n return new WPTB_ElementObject( data );\n }\n },\n wpColorPickerChange: function( event, ui ) {\n let uiColor;\n if( ui ) {\n uiColor = ui.color.toString();\n } else {\n uiColor = '';\n }\n\n let parent = WPTB_Helper.findAncestor( event.target, 'wp-picker-input-wrap' ).getElementsByClassName( 'wptb-color-picker' )[0], classe, type, ps, number;\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\n type = classe[1];\n number = classe[2];\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + type + '-' + number )[0];\n if ( type == 'button' ) {\n if ( parent.dataset.type == 'button-text-color' ) {\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.color = uiColor;\n } else {\n affectedEl.getElementsByClassName( 'wptb-button' )[0].style.backgroundColor = uiColor;\n }\n } else if( type == 'list' ) {\n let ps = affectedEl.querySelectorAll( 'p' );\n if( ps.length > 0 ) {\n for ( let i = 0; i < ps.length; i++ ) {\n ps[i].style.color = uiColor;\n }\n }\n } else if( type == 'star_rating' ) {\n if ( parent.dataset.type == 'star-color' ) {\n let ratingStar = affectedEl.querySelectorAll('li');\n for( let i = 0; i < ratingStar.length; i++ ) {\n let span = ratingStar[i].getElementsByTagName( 'span' );\n for( let j = 0; j < span.length; j++ ) {\n span[j].style.fill = uiColor;\n }\n }\n } else if( parent.dataset.type == 'numeral-rating-color' ) {\n let wptbTextMessageSize = affectedEl.querySelector('.wptb-number-rating');\n wptbTextMessageSize.style.color = uiColor;\n }\n\n } else {\n affectedEl.style.color = uiColor;\n }\n },\n numberImputSize: function ( wptbNumberInputs, maxCount, maxValue ) {\n wptbNumberInputs.onkeydown = function() {\n let thisValue = this.value;\n thisValue = String( thisValue );\n if ( thisValue[0] == 0 ) {\n this.value = \"\";\n } else {\n thisValue = thisValue.substring( 0, maxCount );\n this.value = thisValue;\n }\n }\n wptbNumberInputs.onkeyup = function( ) {\n let thisValue = this.value;\n if ( parseInt( thisValue, 10 ) > parseInt( maxValue, 10 ) ) {\n this.value = maxValue;\n }\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n },\n ucfirst: function( str ) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n },\n wptbDocumentEventGenerate: function( eventName, element, details ) {\n if( eventName && element ) {\n if( ! details ) {\n details = true;\n }\n let event = new CustomEvent( eventName, { detail: details, bubbles: true } );\n element.dispatchEvent( event );\n }\n },\n // run script for the pointed element\n elementStartScript: function( element, kind ) {\n //let script = element.getElementsByTagName( 'script' );\n if(!kind) {\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\n if( infArr && Array.isArray( infArr ) ) {\n kind = infArr[1];\n }\n }\n\n if( kind ) {\n// let wpTemplateId = 'wptb-' + kind + '-script';\n// let template = wp.template( wpTemplateId );\n// let data = {elemClass: infArr[0]};\n// let elementScriptText = template( data );\n// elementScriptText = elementScriptText.replace(/\\r|\\n|\\t/g, '').trim();\n//\n// let scriptNew = document.createElement( 'script' );\n// scriptNew.setAttribute( 'type', 'text/javascript' );\n// scriptNew.innerHTML = elementScriptText;\n// element.parentNode.appendChild( scriptNew );\n\n// element.parentNode.removeChild( scriptNew );\n if( kind in WPTB_ElementsScriptsLauncher ) {\n WPTB_ElementsScriptsLauncher[kind]( element );\n }\n }\n },\n // deletes event handlers from the pointed option element and from all his daughter elements\n deleteEventHandlers: function( element ) {\n if( element ) {\n jQuery( element ).off();\n let elementChildren = element.children;\n if( elementChildren ) {\n for ( let i = 0; i < elementChildren.length; i++ ) {\n WPTB_Helper.deleteEventHandlers( elementChildren[i] );\n }\n }\n } else {\n return;\n }\n },\n // replace all occurrences in a string\n replaceAll: function( string, search, replace ){\n return string.split( search ).join( replace );\n },\n // clears code from TinyMCE attributes\n elementClearFromTinyMce: function( element ) {\n let mceContentBodys = element.querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n\n let dataMceStyle = element.querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n\n let mceEditFocus = element.querySelectorAll( '.mce-edit-focus' );\n if( mceEditFocus.length > 0 ) {\n for ( let k = 0; k < mceEditFocus.length; k++ ) {\n mceEditFocus[k].classList.remove( 'mce-edit-focus' );\n }\n }\n\n let contentEditable = element.querySelectorAll( '[contenteditable]' );\n if ( contentEditable.length > 0 ) {\n for ( let k = 0; k < contentEditable.length; k++ ) {\n contentEditable[k].removeAttribute( 'contenteditable' );\n }\n }\n\n let spellCheck = element.querySelectorAll( '[spellcheck]' );\n if ( spellCheck.length > 0 ) {\n for ( let k = 0; k < spellCheck.length; k++ ) {\n spellCheck[k].removeAttribute( 'spellcheck' );\n }\n }\n\n let mceIds = element.querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n\n return element;\n },\n elementOptionContainerCustomClassSet: function( targetInput, customClassForContainer ) {\n if( targetInput && customClassForContainer ) {\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\n if( containerElement ) {\n containerElement.classList.add( customClassForContainer );\n }\n }\n },\n elementOptionContainerAdditionalStyles: function( targetInput, containerAdditionalStyles ) {\n if( targetInput && containerAdditionalStyles ) {\n let containerElement = WPTB_Helper.findAncestor( targetInput, 'wptb-element-option' );\n let containerStylesArrOne = containerAdditionalStyles.split( ';' );\n\n if( containerElement && containerStylesArrOne ) {\n function containerStylesSet( containerStyleStr, containerElement ) {\n if( containerStyleStr ) {\n containerStyleStrArr = containerStyleStr.split( ':' );\n\n if( containerStyleStrArr && Array.isArray( containerStyleStrArr ) ) {\n containerElement.style[containerStyleStrArr[0]] = containerStyleStrArr[1];\n }\n }\n }\n if( containerStylesArrOne && Array.isArray( containerStylesArrOne ) ) {\n for( let i = 0; i < containerStylesArrOne.length; i++ ) {\n if( containerStylesArrOne[i] ) {\n containerStylesSet( containerStylesArrOne[i], containerElement );\n }\n }\n } else {\n containerStylesSet( containerStylesArrOne, containerElement );\n }\n }\n }\n },\n // function which set handler for event of changes of control\n controlsInclude: function( element, functionHandler, acceptEventValues = false ) {\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\n element.addEventListener( 'element:controls:active', function() {\n if(!element.hasOwnProperty('controlConnectFunctionsName') ||\n !Array.isArray(element.controlConnectFunctionsName) ||\n element.controlConnectFunctionsName.indexOf(functionHandler.name) == -1) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i ),\n elementKind;\n\n if( infArr && Array.isArray( infArr ) ) {\n elementKind = infArr[1];\n }\n\n// if( ! element.hasOwnProperty( 'сontrolsConnectIndic' ) || element.сontrolsConnectIndic !== true && elementKind ) {\n// let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\n// if( elementsSettingsTemplateJs.length > 0 ) {\n// elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\n//\n// let elementsSettings = elementsSettingsTemplateJs.innerHTML;\n// let controlClassesNames = [];\n// if( elementsSettings ) {\n// elementsSettings = elementsSettings.trim();\n// elementsSettings = JSON.parse( elementsSettings );\n// if( elementsSettings && typeof elementsSettings === 'object' ) {\n// if( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] in elementsSettings ) {\n// let elementSettings = elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\n// if( elementSettings && typeof elementSettings === 'object' ) {\n// Object.keys( elementSettings ).forEach( function( key ) {\n// let regularText = new RegExp( 'data-wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\n// let keyInfArr = key.match( regularText );\n// if( keyInfArr && Array.isArray( keyInfArr ) ) {\n// let controlClass = key.replace( 'data-', '' );\n// controlClassesNames.push( [controlClass, keyInfArr[2]] );\n// }\n// });\n// }\n// }\n// }\n// }\n// }\n// }\n if( elementKind ){\n let elementOptionsGroupIds = element.optionsGroupIds;\n if(elementOptionsGroupIds && Array.isArray(elementOptionsGroupIds)) {\n for(let i = 0; i < elementOptionsGroupIds.length; i++) {\n let elementOptionsGroupId = elementOptionsGroupIds[i];\n\n let elementOptionsGroup = document.getElementById(elementOptionsGroupId);\n\n let controlActiveElements = elementOptionsGroup.querySelectorAll('.wptb-element-property');\n controlActiveElements = [...controlActiveElements];\n\n controlActiveElements.map(controlActiveElement => {\n let regularText = new RegExp( 'wptb-el-' + elementKind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\n let controlInfArr = controlActiveElement.className.match( regularText );\n if( controlInfArr && Array.isArray( controlInfArr ) ) {\n let controlUnicClassName = controlInfArr[0];\n\n element.addEventListener( 'wptb-control:' + controlUnicClassName, function(e) {\n let controls = {};\n let controlName = controlInfArr[2];\n let control = document.getElementsByClassName( controlUnicClassName );\n if( control.length > 0 && controlName ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\n\n if(acceptEventValues) {\n controls[controlName] = {\n targetValue: targetControlValue,\n eventValue: e.detail.value\n }\n }else {\n controls[controlName] = targetControlValue;\n }\n }\n functionHandler( controls, element );\n }, false );\n }\n });\n }\n }\n //let elementOptionsContainer = document.querySelector( '.wptb-element-options.wptb-options-' + infArr[1] + '-' + infArr[2] );\n\n // from time to time depend on table cells hierarchy, cell td items may catch mouse clicks which are intended for elements. since the active section is not cell management, this will gives and unharmfull error of not found element, simple check for null equality will be sufficient for now.\n // if(!elementOptionsContainer){\n // return;\n // }\n\n // let elementOptions = elementOptionsContainer.querySelectorAll( '.wptb-element-option' );\n // let controlActiveElements = elementOptions[i].querySelector( '.wptb-element-property' );\n //\n //\n // for( let i = 0; i < elementOptions.length; i++ ) {\n // let controlActiveElement = elementOptions[i].querySelector( '.wptb-element-property' );\n // if( controlActiveElement ) {\n //\n // }\n // }\n\n if(!element.controlConnectFunctionsName && !Array.isArray(element.controlConnectFunctionsName)) {\n element.controlConnectFunctionsName = [];\n }\n\n element.controlConnectFunctionsName.push( functionHandler.name );\n }\n }\n }, false );\n }\n },\n oneControlInclude: function( element, functionHandler, controlName ) {\n if( element && typeof element === 'object' && typeof functionHandler === 'function' && typeof controlName === 'string' ) {\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i ),\n elementKind;\n\n if( infArr && Array.isArray( infArr ) ) {\n elementKind = infArr[1].split( '-' )[0];\n\n let wptbContrlStacksConfigId = 'wptb-' + elementKind + '-control-stack';\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\n let data = {\n container: '.' + infArr[0]\n };\n let jsonControlsConfigJson = tmplControlsConfig( data );\n let jsonControlsConfig = JSON.parse( jsonControlsConfigJson );\n\n if( jsonControlsConfig && typeof jsonControlsConfig === 'object' && jsonControlsConfig.hasOwnProperty( controlName ) ) {\n let controlClassName = 'wptb-el-' + infArr[1] + '-' + controlName;\n\n element.addEventListener( 'wptb-control:' + controlClassName, function( event ) {\n let control = document.getElementsByClassName( controlClassName );\n if( control.length > 0 ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( control );\n\n functionHandler( targetControlValue, element );\n }\n }, false );\n }\n }\n } else {\n return false;\n }\n },\n //\n innerElementCopyIncludeHandler: function( element, functionHandler ) {\n if( element && typeof element === 'object' && typeof functionHandler === 'function' ) {\n element.addEventListener( 'wptb-inner-element:copy', function( event ) {\n let innerElement = event.detail;\n if( innerElement ) {\n WPTB_Helper.elementClearFromTinyMce( innerElement );\n functionHandler( innerElement, element );\n }\n }, false );\n }\n },\n /**\n * Sets the control elements when changing which to will restart this control\n * @param {array} dependOnControlName\n * @param {string} targetControlElementClass\n * @param {array} valueDependOnControlCorrect\n * @param {string} kind\n * @param {HTMLElement} element\n */\n valueDependOnControl: function(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect, kind, element) {\n function dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect) {\n if(typeof dependOnControlName === 'string') {\n dependOnControlName = [dependOnControlName];\n }\n let infArr = targetControlElementClass.match(/wptb-el-((.+-)\\d+)-(.+)/i);\n let valueDependOnControl = {};\n let dependOnControlElementsArr = [];\n if (infArr && Array.isArray(infArr)) {\n let controlName = infArr[3];\n let dependOnControlElements;\n let valueDependOnControlCorrectObj = {};\n if(Array.isArray(valueDependOnControlCorrect)) {\n if(Array.isArray(valueDependOnControlCorrect[0])) {\n valueDependOnControlCorrect.map(s => {\n valueDependOnControlCorrectObj[s[0]] = [s[1], s[2]];\n });\n } else {\n valueDependOnControlCorrectObj[valueDependOnControlCorrect[0]] = [valueDependOnControlCorrect[1], valueDependOnControlCorrect[2]];\n }\n }\n dependOnControlName.map(s => {\n let dependOnControlElementClass = targetControlElementClass.replace(controlName, s);\n if(dependOnControlElementClass) {\n dependOnControlElements = document.getElementsByClassName(dependOnControlElementClass);\n if(dependOnControlElements.length > 0 && dependOnControlElements[0].type) {\n valueDependOnControl[s] = dependOnControlElements[0].value;\n if(s in valueDependOnControlCorrectObj) {\n if(valueDependOnControlCorrectObj[s][1] === 'integer') {\n valueDependOnControl[s] = parseInt(valueDependOnControl[s]) + parseInt(valueDependOnControlCorrectObj[s][0]);\n } else if(valueDependOnControlCorrectObj[s][1] === 'string') {\n valueDependOnControl[s] = valueDependOnControl[s] + valueDependOnControlCorrectObj[s][0];\n }\n }\n dependOnControlElementsArr.push(dependOnControlElements[0]);\n }\n }\n });\n }\n\n return [valueDependOnControl, dependOnControlElementsArr];\n }\n\n let dependOnControlData = dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect);\n WPTB_Helper.elementOptionsSet(kind, element, dependOnControlData[0], targetControlElementClass);\n\n Object.keys(dependOnControlData[0]).forEach(function (key) {\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n let unicClass = 'wptb-el-' + infArr[1] + '-' + [key];\n element.addEventListener(`wptb-control:${unicClass}`, function(event){\n let dependOnControlData = dependOnControlDataGet(dependOnControlName, targetControlElementClass, valueDependOnControlCorrect);\n WPTB_Helper.elementOptionsSet(kind, element, dependOnControlData[0], targetControlElementClass);\n }, false);\n });\n },\n /**\n * Sets the visibility of one control to depend on the state of other controls\n * @param dependOnMain\n * @param targetControlElementClass\n */\n appearDependOnControl: function( dependOnMain, targetControlElementClass ) {\n if( Array.isArray( dependOnMain ) ) {\n if(typeof dependOnMain[0] === 'string') {\n dependOnMain = [dependOnMain];\n } else if(!Array.isArray(dependOnMain[0])) {\n return;\n }\n let dependOnControlElementsValue = {};\n for(let i = 0; i < dependOnMain.length; i++) {\n let dependOn = dependOnMain[i];\n let dependOnControlName = dependOn[0];\n let infArr = targetControlElementClass.match(/wptb-el-((.+-)\\d+)-(.+)/i);\n\n if (infArr && Array.isArray(infArr)) {\n let controlName = infArr[3];\n\n let dependOnControlElementClass = targetControlElementClass.replace(controlName, dependOnControlName);\n if(dependOnControlElementClass) {\n let dependOnControlElements = document.getElementsByClassName(dependOnControlElementClass);\n if(dependOnControlElements.length > 0) {\n dependOnControlElementsValue[dependOn[0]] = [dependOnControlElementValue(dependOnControlElements, dependOn), dependOnControlElements, dependOn];\n }\n }\n }\n }\n\n let targetControlElement = document.getElementsByClassName( targetControlElementClass );\n if( targetControlElement.length > 0 ) {\n targetControlElement = targetControlElement[0];\n let controlContainerElem = WPTB_Helper.findAncestor( targetControlElement, 'wptb-element-option' );\n\n if( controlContainerElem ) {\n showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue);\n\n Object.keys(dependOnControlElementsValue).map(k => {\n if (Object.prototype.hasOwnProperty.call(dependOnControlElementsValue, k)) {\n let dependOnControlElements = dependOnControlElementsValue[k][1];\n let dependOnControlElement = dependOnControlElements[0];\n dependOnControlElement.addEventListener( 'change', dependOnControlElementChangeHandler.bind(null, controlContainerElem, dependOnControlElementsValue, k), false );\n }\n });\n }\n }\n\n function dependOnControlElementChangeHandler(controlContainerElem, dependOnControlElementsValue, k) {\n let dependOn = dependOnControlElementsValue[k][2];\n let dependOnControlElements = dependOnControlElementsValue[k][1];\n dependOnControlElementsValue[dependOn[0]] = [dependOnControlElementValue(dependOnControlElements, dependOn), dependOnControlElements, dependOn];\n showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue)\n }\n\n function showHideTargetControlElement(controlContainerElem, dependOnControlElementsValue) {\n let display = 'block';\n Object.keys(dependOnControlElementsValue).map(k => {\n if (Object.prototype.hasOwnProperty.call(dependOnControlElementsValue, k)) {\n if(dependOnControlElementsValue[k][0] === false){\n display = 'none';\n }\n }\n })\n\n controlContainerElem.style.display = display;\n }\n\n function dependOnControlElementValue(dependOnControlElements, dependOn) {\n let targetControlValue = WPTB_Helper.targetControlValueGet(dependOnControlElements);\n\n if(dependOn[1] && Array.isArray(dependOn[1]) &&\n (dependOn[1].indexOf(targetControlValue) !== -1 )) {\n return true;\n // let childCheck = controlContainerElem.querySelector('input[type=\"checkbox\"]')\n // if (childCheck) {\n // childCheck.checked = true;\n // }\n } else if(dependOn[2] && Array.isArray(dependOn[2]) &&\n (dependOn[2].indexOf(targetControlValue) !== -1)) {\n return false;\n }\n }\n }\n },\n //\n controlsStateManager: function ( targetControlClass, controlChangeIndic ) {\n let targetControls = document.getElementsByClassName( targetControlClass );\n if( targetControls.length > 0 ) {\n //targetControls = targetControls[0];\n\n let infArr = targetControlClass.match( /wptb-el-((.+-)\\d+)-(.+)/i );\n\n if( infArr && Array.isArray( infArr ) ) {\n let selectorElement;\n selectorElement = document.querySelector( '.wptb-element-' + infArr[1] );\n\n if( selectorElement ) {\n let elementsSettingsTemplatesJs;\n let elementSettings = {};\n let elementsSettings;\n elementsSettingsTemplatesJs = document.getElementsByClassName( 'wptb-element-datas' );\n if( elementsSettingsTemplatesJs.length == 0 || elementsSettingsTemplatesJs[0].innerHTML == '' ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\n elementSettings['data-' + targetControlClass] = targetControlValue;\n\n elementsSettings = {};\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = elementSettings;\n elementsSettings = JSON.stringify( elementsSettings );\n\n if( elementsSettingsTemplatesJs.length == 0 ) {\n elementsSettingsTemplatesJs = document.createElement( 'script' );\n elementsSettingsTemplatesJs.setAttribute( 'type', 'text/html' );\n elementsSettingsTemplatesJs.setAttribute( 'class', 'wptb-element-datas' );\n } else {\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\n }\n\n elementsSettingsTemplatesJs.innerHTML = elementsSettings;\n\n let body = document.getElementsByTagName('body')[0];\n body.appendChild( elementsSettingsTemplatesJs );\n } else {\n elementsSettingsTemplatesJs = elementsSettingsTemplatesJs[0];\n elementsSettings = elementsSettingsTemplatesJs.innerHTML;\n if( elementsSettings ) {\n elementsSettings = elementsSettings.trim();\n elementsSettings = JSON.parse( elementsSettings );\n\n if( elementsSettings && typeof elementsSettings === 'object' ) {\n\n\n if( controlChangeIndic ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\n }\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\n } else if( ! ( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) ) {\n let targetControlValue = WPTB_Helper.targetControlValueGet( targetControls );\n if( ! ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) ||\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] !== 'object') {\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] = {};\n }\n elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass] = targetControlValue;\n elementsSettingsTemplatesJs.innerHTML = JSON.stringify( elementsSettings );\n } else if( ( ( 'tmpl-wptb-el-datas-' + infArr[1] ) in elementsSettings ) &&\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] === 'object' &&\n ( 'data-' + targetControlClass ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1]] ) {\n for( let i = 0; i < targetControls.length; i++ ) {\n if( targetControls[i].type == 'checkbox' ) {\n let targetControlValue;\n if( targetControls[i].name ) {\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass][targetControls[i].name];\n } else {\n targetControlValue = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\n }\n\n if( targetControlValue == 'checked' ) {\n targetControls[i].checked = true;\n } else if( targetControlValue == 'unchecked' ) {\n targetControls[i].checked = false;\n }\n } else {\n targetControls[i].value = elementsSettings['tmpl-wptb-el-datas-' + infArr[1]]['data-' + targetControlClass];\n }\n }\n }\n }\n }\n }\n }\n }\n }\n },\n //\n targetControlValueGet: function( targetControls ) {\n let targetControlValue;\n for( let i = 0; i < targetControls.length; i++ ) {\n if( targetControls[i].type == 'checkbox' && targetControls[i].name ) {\n if( ! targetControlValue ) targetControlValue = {};\n if( targetControls[i].checked == true ) {\n targetControlValue[targetControls[i].name] = 'checked';\n } else {\n targetControlValue[targetControls[i].name] = 'unchecked';\n }\n } else if( targetControls[i].type == 'checkbox' ) {\n if( targetControls[i].checked == true ) {\n targetControlValue = 'checked';\n } else {\n targetControlValue = 'unchecked';\n }\n } else if( targetControls[i].type ) {\n targetControlValue = targetControls[i].value;\n } else if( targetControls[i].dataset.alignmentValue && targetControls[i].classList.contains( 'selected' ) ){\n targetControlValue = targetControls[i].dataset.alignmentValue;\n }\n }\n return targetControlValue;\n },\n //\n elementControlsStateCopy: function( elementProt, copyElem ) {\n if( elementProt && copyElem ) {\n let infArrProt = elementProt.className.match( /wptb-element-((.+-)\\d+)/i );\n let infArrCopy = copyElem.className.match( /wptb-element-((.+-)\\d+)/i );\n if( infArrProt && Array.isArray( infArrProt ) &&\n infArrCopy && Array.isArray( infArrCopy )) {\n let elemProtKind = infArrProt[1];\n let elemCopyKind = infArrCopy[1];\n let elementsSettingsTemplateJs = document.getElementsByClassName( 'wptb-element-datas' );\n if( elementsSettingsTemplateJs.length > 0 ) {\n elementsSettingsTemplateJs = elementsSettingsTemplateJs[0];\n\n let elementsSettings = elementsSettingsTemplateJs.innerHTML;\n if( elementsSettings ) {\n elementsSettings = elementsSettings.trim();\n elementsSettings = JSON.parse( elementsSettings );\n\n if( elementsSettings && typeof elementsSettings === 'object' ) {\n let elementSettingsProt = elementsSettings['tmpl-wptb-el-datas-' + elemProtKind];\n if( elementSettingsProt && typeof elementSettingsProt === 'object' ) {\n let elementSettingsCopy = {};\n\n Object.keys( elementSettingsProt ).forEach( function( key ) {\n let elementSettingValue = elementSettingsProt[key];\n let elementSettingKeyCopy = key.replace( elemProtKind, elemCopyKind );\n elementSettingsCopy[elementSettingKeyCopy] = elementSettingValue;\n });\n\n if( Object.keys( elementSettingsCopy ).length > 0 ) {\n elementsSettings['tmpl-wptb-el-datas-' + elemCopyKind] = elementSettingsCopy;\n\n elementsSettings = JSON.stringify( elementsSettings );\n elementsSettingsTemplateJs.innerHTML = elementsSettings;\n }\n }\n }\n }\n }\n }\n }\n },\n //\n elementControlsStateDelete: function( element, nameControl ) {\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n let body = document.getElementsByTagName( 'body' )[0];\n let wptbElementDatas = body.getElementsByClassName( 'wptb-element-datas' );\n if( infArr && Array.isArray( infArr ) && wptbElementDatas.length > 0 ) {\n wptbElementDatas = wptbElementDatas[0];\n let elementsSettings = wptbElementDatas.innerHTML;\n if( elementsSettings ) {\n elementsSettings = elementsSettings.trim();\n elementsSettings = JSON.parse( elementsSettings );\n if( elementsSettings && typeof elementsSettings === 'object' &&\n ( ( 'tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2] ) in elementsSettings ) ) {\n if( ! nameControl ) {\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]];\n } else {\n if( elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] &&\n typeof elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] === 'object' &&\n ( 'data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl ) in elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]] ) {\n delete elementsSettings['tmpl-wptb-el-datas-' + infArr[1] + '-' + infArr[2]]['data-wptb-el-' + infArr[1] + '-' + infArr[2] + '-' + nameControl];\n }\n }\n\n if( Object.keys( elementsSettings ).length == 0 ) {\n body.removeChild( wptbElementDatas );\n } else {\n elementsSettings = JSON.stringify( elementsSettings );\n wptbElementDatas.innerHTML = elementsSettings;\n }\n }\n }\n }\n },\n //\n elementOptionsSet: function( kind, element, valueDependOnControl, targetControlElementClass ) {\n // get controls config for this element\n let wptbContrlStacksConfigId = 'wptb-' + kind + '-control-stack';\n let tmplControlsConfig = wp.template( wptbContrlStacksConfigId );\n let data;\n let elementContainerClass;\n let elementOptionClassIndic;\n let elementOptionsGroup;\n\n let controlElementParent;\n let elementOptionsScriptsContainer;\n\n let infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n if( ! infArr ) {\n let table_id = WPTB_Helper.detectMode();\n if (!table_id) {\n table_id = 'startedid-0';\n }\n if( element.classList.contains( 'wptb-preview-table' ) ) {\n element.classList.add( 'wptb-element-main-table_setting-' + table_id );\n } else if( element.classList.contains( 'wptb-cell' ) ) {\n let cellEditActiveClass = document.querySelector('.wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\n if( ! cellEditActiveClass ) element.classList.add('wptb-element-table_cell_setting-' + element.dataset.xIndex + '-' + element.dataset.yIndex);\n }else if (element.classList.contains('wptb-responsive')){\n element.classList.add('wptb-element-table_responsive_setting-' + table_id);\n }\n\n infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n }\n\n data = {\n container: '.' + infArr[0]\n };\n let controlName;\n data.valueDependOnControl = {};\n if(valueDependOnControl) {\n Object.keys(valueDependOnControl).forEach(function (key) {\n data.valueDependOnControl[key] = valueDependOnControl[key];\n });\n }\n if(targetControlElementClass) {\n let infArr = targetControlElementClass.match(/wptb-el-((.+-)\\d+)-(.+)/i);\n\n if (infArr && Array.isArray(infArr)) {\n controlName = infArr[3];\n }\n }\n\n elementContainerClass = infArr[0];\n elementOptionClassIndic = infArr[1];\n\n if( element.classList.contains( 'wptb-preview-table' ) ) {\n\n } else if( element.classList.contains( 'wptb-cell' ) ) {\n this.activateSection('cell_settings');\n }else if (element.classList.contains('wptb-responsive')){\n elementOptionsGroupId = 'table-responsive-group';\n wptbelementOptionClass = 'wptb-element-option';\n }\n else {\n let children = document.getElementById( 'element-options-group' ).childNodes;\n for ( let i = 0; i < children.length; i++) {\n if ( children[i].style )\n children[i].style.display = 'none';\n }\n this.activateSection('options_group');\n }\n\n let controlsConfigJson = tmplControlsConfig( data );\n let controlsConfig = JSON.parse( controlsConfigJson );\n\n let elementOptionsGroupIdsInvolved = [],\n elementOptionsGroupInvolved = {},\n elementOptionsContainerInvolved = {};\n\n // object for save all scrips for each controls\n let controlScriptsObj = {};\n\n // array for keep \"appear depend on\" params\n let controlappearDependOnControl = [];\n\n // array for keep \"value depend on\" params\n let controlValueDependOnControl = [];\n\n // create controls\n let elementOptionsScriptsContainerIndic = false;\n if(controlName) {\n let controlsConfigNew = {};\n controlsConfigNew[controlName] = controlsConfig[controlName];\n controlsConfig = controlsConfigNew;\n }\n let i = 0;\n Object.keys( controlsConfig ).forEach( function( key ) {\n let data = controlsConfig[key];\n data.controlKey = key;\n\n // get necessary wp js template\n let tmplControlTemplate = wp.template( 'wptb-' + data.type + '-control' );\n\n data.elemContainer = elementContainerClass;\n data.elementControlTargetUnicClass = 'wptb-el-' + elementOptionClassIndic + '-' + data.controlKey;\n Object.keys(data).map(k => {\n if (Object.prototype.hasOwnProperty.call(data, k) && data[k] === 'control_param_calculate_value') {\n data[k] = WPTB_Helper.controlParamCalculateValue(data.elementControlTargetUnicClass, k);\n }\n });\n let controlTemplate = tmplControlTemplate( data );\n if( 'appearDependOnControl' in data ) {\n if( Array.isArray( data.appearDependOnControl ) ) {\n controlappearDependOnControl.push( [data.appearDependOnControl, data.elementControlTargetUnicClass] );\n }\n }\n\n if('valueDependOnControl' in data && !valueDependOnControl && !targetControlElementClass) {\n let valueDependOnControlCorrect = '';\n if(data.valueDependOnControlCorrect) valueDependOnControlCorrect = data.valueDependOnControlCorrect;\n controlValueDependOnControl.push([data.valueDependOnControl, data.elementControlTargetUnicClass, valueDependOnControlCorrect]);\n }\n\n function elementOptionsContainerInvolvedGet(elementOptionsGroupId, elementOptionsContainerInvolved) {\n if(!elementOptionsContainerInvolved[elementOptionsGroupId]){\n let elementOptionsContainer = document.createElement( 'div' );\n elementOptionsContainer.classList.add( 'wptb-element-options', 'wptb-options-' + infArr[1] );\n document.getElementById( elementOptionsGroupId ).appendChild(elementOptionsContainer);\n elementOptionsContainerInvolved[elementOptionsGroupId] = elementOptionsContainer;\n }\n\n return elementOptionsContainerInvolved[elementOptionsGroupId];\n }\n\n if(elementOptionsGroupIdsInvolved.indexOf(data.elementOptionsGroupId) == -1 && !controlName) {\n elementOptionsGroupIdsInvolved.push(data.elementOptionsGroupId);\n // clear elements from options group\n //document.getElementById( 'element-options-group' ).innerHTML = '';\n elementOptionsGroup = document.getElementById(data.elementOptionsGroupId);\n let elementOptionsGroupChildren = [...elementOptionsGroup.children];\n for( let i = 0; i < elementOptionsGroupChildren.length; i++ ) {\n elementOptionsGroup.removeChild( elementOptionsGroupChildren[i] );\n }\n elementOptionsGroupInvolved[data.elementOptionsGroupId] = elementOptionsGroup;\n }\n\n controlElementParent = elementOptionsGroupInvolved[data.elementOptionsGroupId];\n\n if(data.elementOptionsContainerOn === 'true' && !controlName) {\n controlElementParent = elementOptionsContainerInvolvedGet(data.elementOptionsGroupId, elementOptionsContainerInvolved);\n }\n\n\n if(data.elementOptionContainerOn === 'true') {\n let elementOptionContainer = document.createElement( 'div' );\n elementOptionContainer.classList.add( data.elementOptionClass, 'wptb-settings-items' );\n\n if( data.customClassForContainer ) {\n elementOptionContainer.classList.add( data.customClassForContainer );\n }\n\n if( data.containerAdditionalStyles ) {\n elementOptionContainer.setAttribute( 'style', data.containerAdditionalStyles );\n }\n\n if(targetControlElementClass) {\n let targetControlElement = document.getElementsByClassName( targetControlElementClass );\n if( targetControlElement.length > 0 ) {\n targetControlElement = targetControlElement[0];\n let controlContainerElem = WPTB_Helper.findAncestor(targetControlElement, 'wptb-element-option');\n\n if (controlContainerElem) {\n let controlContainerElemParent = controlContainerElem.parentNode;\n controlContainerElemParent.insertBefore(elementOptionContainer, controlContainerElem);\n controlContainerElemParent.removeChild(controlContainerElem);\n }\n }\n } else {\n controlElementParent.appendChild( elementOptionContainer );\n }\n controlElementParent = elementOptionContainer;\n }\n controlElementParent.innerHTML = controlElementParent.innerHTML + controlTemplate;\n\n let helperJavascriptElem = controlElementParent.getElementsByTagName( 'wptb-template-script' );\n if( helperJavascriptElem.length > 0 ) {\n helperJavascriptElem = helperJavascriptElem[0];\n let helperJavascriptCode = helperJavascriptElem.innerText;\n controlElementParent.removeChild( helperJavascriptElem );\n let script = document.createElement( 'script' );\n script.setAttribute( 'type', 'text/javascript' );\n script.setAttribute('id', kind + '-' + data.controlKey);\n script.innerHTML = helperJavascriptCode.replace(/\\r|\\n|\\t/g, '').trim();\n if(!controlScriptsObj[data.elementOptionsGroupId] || !Array.isArray(controlScriptsObj[data.elementOptionsGroupId])) {\n controlScriptsObj[data.elementOptionsGroupId] = [];\n }\n controlScriptsObj[data.elementOptionsGroupId].push( script );\n }\n\n i++;\n });\n\n element.optionsGroupIds = elementOptionsGroupIdsInvolved;\n\n Object.keys( controlScriptsObj ).forEach( function( elementOptionsGroupId ) {\n if(!targetControlElementClass) {\n elementOptionsScriptsContainer = document.createElement( 'div' );\n elementOptionsScriptsContainer.classList.add( 'wptb-element-options-scripts', 'wptb-options-' + infArr[1] );\n elementOptionsGroupInvolved[elementOptionsGroupId].appendChild(elementOptionsScriptsContainer);\n }\n\n let controlScriptsArr = controlScriptsObj[elementOptionsGroupId];\n if( controlScriptsArr.length > 0 ) {\n for( let i = 0; i < controlScriptsArr.length; i++ ) {\n if(targetControlElementClass) {\n let id = kind + '-' + controlName;\n let script = document.getElementById(id);\n elementOptionsScriptsContainer = script.parentNode;\n elementOptionsScriptsContainer.insertBefore(controlScriptsArr[i], script);\n elementOptionsScriptsContainer.removeChild(script);\n } else {\n elementOptionsScriptsContainer.appendChild(controlScriptsArr[i]);\n }\n }\n }\n });\n\n // run the scripts of controls\n \n // run appearDependOnControl function\n for ( let i = 0; i < controlappearDependOnControl.length; i++ ) {\n WPTB_Helper.appearDependOnControl( controlappearDependOnControl[i][0], controlappearDependOnControl[i][1] );\n }\n\n WPTB_Helper.wptbDocumentEventGenerate( 'element:controls:active', element );\n // run valueDependOnControl function\n for (let i = 0; i < controlValueDependOnControl.length; i++) {\n WPTB_Helper.valueDependOnControl(controlValueDependOnControl[i][0], controlValueDependOnControl[i][1], controlValueDependOnControl[i][2], kind, element);\n }\n\n },\n\n /**\n *\n * @param unicClass\n * @param controlKey\n * @param key\n * @returns {*}\n */\n controlParamCalculateValue: function(unicClass, key) {\n let unicClassP = WPTB_Helper.replaceAll(unicClass, '-', '_');\n if (window['paramCalculateValue_' + unicClassP + '_' + key] && typeof (window['paramCalculateValue_' + unicClassP + '_' + key]) === \"function\") {\n return window['paramCalculateValue_' + unicClassP + '_' + key]();\n }\n },\n\n controlParamCalculateValueCreateFunction: function(element, controlKey, key, handlerFunction) {\n const infArr = element.className.match( /wptb-element-((.+-)\\d+)/i );\n const unicClass = 'wptb-el-' + infArr[1] + '-' + controlKey;\n let unicClassP = WPTB_Helper.replaceAll(unicClass, '-', '_');\n window['paramCalculateValue_' + unicClassP + '_' + key] = function () {\n return handlerFunction(element);\n };\n },\n\n /**\n * function for create, update css for element\n *\n * @param elementContainer\n * @param selector\n * @param cssName\n * @param cssValue\n */\n managerExternalCssStyles: function( elementContainer, selector, cssName, cssValue ) {\n let infArr = elementContainer.match( /wptb-element-main(.+)-(\\d+)/i );\n if( ! infArr || ! Array.isArray( infArr ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' );\n\n if( table.length > 0 ) {\n table = table[0];\n\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n selector = '.' + infArr[0] + ' ' + selector;\n }\n }\n }\n\n let head = document.head;\n if( head ) {\n let cssForThisElement = head.querySelector( '#styles-' + elementContainer );\n if( cssForThisElement ) {\n let cssText = cssForThisElement.innerHTML;\n if( cssText ) {\n let cssTextArrFirst = cssText.split( '}' );\n cssTextArrFirst.pop();\n let selectorExists = false;\n for( let i = 0; i < cssTextArrFirst.length; i++ ) {\n let cssTextArrSecond = cssTextArrFirst[i].split( '{' );\n if( cssTextArrSecond[0] === selector ) {\n let cssTextArrThird = cssTextArrSecond[1].split( ';' );\n cssTextArrThird.pop();\n let cssNameExists = false;\n for( let j = 0; j < cssTextArrThird.length; j++ ) {\n let cssTextArrFourth = cssTextArrThird[j].split( ':' );\n if( cssTextArrFourth[0] === cssName ) {\n if( cssValue ) {\n cssTextArrThird[j] = cssName + ':' + cssValue;\n } else {\n cssTextArrThird.splice( j, 1 );\n }\n\n cssTextArrSecond[1] = cssTextArrThird.join( ';' ) ? cssTextArrThird.join( ';' ) + ';' : '';\n cssNameExists = true;\n break;\n }\n }\n if( ! cssNameExists ) {\n if( cssValue ) {\n cssTextArrSecond[1] += cssName + ':' + cssValue + ';';\n }\n }\n if( cssTextArrSecond[1] ) {\n cssTextArrFirst[i] = cssTextArrSecond[0] + '{' + cssTextArrSecond[1]\n } else {\n cssTextArrFirst.splice( i, 1 );\n }\n if( cssTextArrFirst.join( '}' ) ) {\n cssForThisElement.innerHTML = cssTextArrFirst.join( '}' ) + '}';\n } else {\n head.removeChild( cssForThisElement );\n }\n\n selectorExists = true;\n break;\n }\n }\n\n if( ! selectorExists ) {\n if( cssValue ) {\n cssForThisElement.innerHTML = cssText + selector + '{' + cssName + ':' + cssValue + ';}';\n } else {\n cssForThisElement.innerHTML = cssText;\n }\n }\n } else {\n if( cssValue ) {\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\n } else {\n head.removeChild( cssForThisElement );\n }\n }\n } else {\n if( cssValue ) {\n let cssForThisElement = document.createElement( 'style' );\n cssForThisElement.setAttribute( 'id', 'styles-' + elementContainer );\n cssForThisElement.classList.add( 'styles-wptb-elements' );\n cssForThisElement.innerHTML = selector + '{' + cssName + ':' + cssValue + ';}';\n head.appendChild( cssForThisElement );\n }\n }\n }\n },\n /**\n *\n * Register section parts for sidebar\n *\n * @param {array} sections an array of section names\n */\n registerSections(sections) {\n this.sections = {};\n this.currentSection = '';\n if (!Array.isArray(sections)) {\n sections = [sections];\n }\n\n sections.map(s => {\n const sectionElement = document.querySelector(`[data-wptb-section=${s}]`);\n if (sectionElement) {\n this.sections[s] = sectionElement;\n }\n })\n },\n /**\n * Activate a registered section and deactivates others\n *\n * @param {string} sectionDataId section name to be activated\n * @param {string} displayType display type override for section to be used in its display style property\n */\n activateSection(sectionDataId, displayType = 'block') {\n this.currentSection=sectionDataId;\n this.triggerSectionEvent(sectionDataId);\n Object.keys(this.sections).map(k => {\n if (Object.prototype.hasOwnProperty.call(this.sections, k)) {\n const visibility = sectionDataId === k ? displayType : 'none';\n this.sections[k].style = `display: ${visibility} !important`;\n }\n })\n },\n /**\n * Get id of current active section\n *\n * @returns {string} active section i\n */\n getCurrentSection(){\n return this.currentSection;\n },\n /**\n * Get current section from search parameter 'wptb-builder-section' of window location\n */\n getSectionFromUrl(){\n const parsedUrl = new URL(window.location.href);\n const urlSection = parsedUrl.searchParams.get('wptb-builder-section');\n if(urlSection){\n if(Object.keys(this.sections).some(key => key===urlSection)){\n this.activateSection(urlSection);\n }\n }\n },\n /**\n * Set up related buttons and links to trigger certain elements\n */\n setupSectionButtons() {\n const sectionButtons = Array.from( document.querySelectorAll('[data-wptb-section-button'));\n const vm = this;\n\n sectionButtons.map(s => {\n const sectionName = s.dataset.wptbSectionButton;\n s.addEventListener('click', function() {\n const displayType = s.dataset.wptbSectionDisplayType;\n vm.activateSection(sectionName, displayType);\n })\n\n document.addEventListener('wptbSectionChanged', (e)=> {\n if(e.detail === sectionName){\n s.classList.remove('disabled');\n s.classList.add('active');\n }else{\n s.classList.remove('active');\n s.classList.add('disabled');\n }\n })\n })\n },\n setupPanelToggleButtons(){\n const $ = jQuery;\n\n $('.wptb-panel-toggle-group').each(function(){\n const vm = $(this);\n $(this).find('.toggle-icon').click(() => {\n vm.find('.wptb-panel-toggle-target').slideToggle();\n vm.toggleClass('wptb-panel-toggle-content');\n })\n })\n },\n /**\n * Trigger a section change event\n *\n * @param {string} sectionName section name\n */\n triggerSectionEvent(sectionName){\n const sectionEvent = new CustomEvent('wptbSectionChanged', {detail: sectionName});\n\n document.dispatchEvent(sectionEvent);\n },\n /**\n * Setup sidebar toggle element\n *\n * @param {string} toggleSelector query selector for drawer toggle element\n */\n setupSidebarToggle(toggleSelector){\n const toggleButton = document.querySelector(toggleSelector);\n if(toggleButton){\n toggleButton.addEventListener('click', (e)=>{\n e.preventDefault();\n document.body.classList.toggle('collapsed');\n })\n }\n },\n // function for deleting all external CSS for the element\n externalCssStylesDelete: function( elementContainerClass ) {\n let head = document.head;\n if( head ) {\n let cssForThisElement = head.querySelector( '#styles-' + elementContainerClass );\n\n if( cssForThisElement ) {\n head.removeChild( cssForThisElement );\n }\n }\n },\n // function for copy all external CSS for the element\n externalCssStylesCopy: function( activeElement, copyElement ) {\n if( activeElement ) {\n let infArr = activeElement.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n let activeElemClass = infArr[0];\n\n let head = document.head;\n if( head ) {\n let cssForActiveElement = head.querySelector( '#styles-' + activeElemClass );\n\n if( cssForActiveElement ) {\n let cssForNewElement = cssForActiveElement.cloneNode( true );\n\n cssForNewElement.removeAttribute( 'id', 'styles-' + activeElemClass );\n\n let infArrCopyEl = copyElement.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArrCopyEl && Array.isArray( infArrCopyEl ) ) {\n cssForNewElement.setAttribute( 'id', 'styles-' + infArrCopyEl[0] );\n let cssForActiveElementInnerHTML = cssForActiveElement.innerHTML;\n let cssForNewElementInnerHTML = WPTB_Helper.replaceAll( cssForActiveElementInnerHTML, activeElemClass, infArrCopyEl[0] );\n cssForNewElement.innerHTML = cssForNewElementInnerHTML;\n head.appendChild( cssForNewElement );\n }\n }\n }\n }\n }\n },\n // function for convertation elements stiles in json\n elementsStylesConvertToObject: function() {\n let head = document.head;\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\n let stylesObj = {};\n for( let i = 0; i < stylesElements.length; i++ ) {\n let styleElemId = stylesElements[i].getAttribute( 'id' );\n if( styleElemId && stylesElements[i].innerHTML ) {\n stylesObj[styleElemId] = stylesElements[i].innerHTML;\n }\n }\n\n if( Object.keys( stylesObj ).length != 0 ) {\n return JSON.stringify( stylesObj );\n }\n return '';\n },\n // function for set scc styles tags to head\n elementsStylesSetFromObject: function( jsonObject ) {\n let head = document.head;\n if( head ) {\n let stylesElements = head.querySelectorAll( '.styles-wptb-elements' );\n if( stylesElements.length > 0 ) {\n stylesElements = [...stylesElements];\n for( let i = 0; i < stylesElements.length; i++ ) {\n head.removeChild( stylesElements[i] );\n }\n }\n if( jsonObject ) {\n let stylesObj = JSON.parse( jsonObject );\n if( Object.keys( stylesObj ).length != 0 ) {\n Object.keys( stylesObj ).forEach( function( key ) {\n let cssText = stylesObj[key];\n let styleCss = document.createElement( 'style' );\n styleCss.setAttribute( 'id', key );\n styleCss.classList.add( 'styles-wptb-elements' );\n styleCss.innerHTML = cssText;\n head.appendChild( styleCss );\n });\n }\n }\n }\n },\n // function for table saving\n saveTable: function( event, startSaving, previewSaving ) {\n if( ! previewSaving && ! startSaving ) {\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) ||\n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\n //return;\n }\n }\n\n if( ! previewSaving ) {\n let bar = document.querySelector( '.wptb-edit-bar' );\n if ( bar && bar.classList.contains( 'visible' ) ) {\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\n WPTB_Helper.toggleTableEditMode();\n }\n }\n\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\n messagingArea,\n code,\n datas;\n\n code = document.getElementsByClassName( 'wptb-preview-table' );\n\n let postId;\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\n postId = rs;\n }\n let paramIdsNecessaryChange = false;\n if( code.length > 0 ) {\n code = code[0];\n let codeClone = code.cloneNode( true );\n if( postId ) {\n if( codeClone.classList.contains( 'wptb-element-main-table_setting-startedid-0' ) ) {\n codeClone.classList.remove( 'wptb-element-main-table_setting-startedid-0' );\n codeClone.classList.add( 'wptb-element-main-table_setting-' + postId );\n let wptbTableSetup = document.querySelector('.wptb-table-setup');\n if(wptbTableSetup) {\n wptbTableSetup.innerHTML = '';\n wptbTableSetup.appendChild(codeClone);\n WPTB_Table();\n }\n paramIdsNecessaryChange = true;\n }\n }\n codeClone.columns = code.columns;\n code = WPTB_Stringifier( codeClone );\n code = code.outerHTML;\n } else {\n code = '';\n }\n\n if( ! previewSaving ) {\n datas = '';\n let datas_containers = document.getElementsByClassName( 'wptb-element-datas' );\n\n if( datas_containers.length > 0 ) {\n if( datas_containers[0].innerHTML ) {\n datas = datas_containers[0].innerHTML;\n\n if( paramIdsNecessaryChange ) {\n datas = WPTB_Helper.replaceAll( datas, 'tmpl-wptb-el-datas-main-table_setting-startedid-0',\n 'tmpl-wptb-el-datas-main-table_setting-' + postId );\n\n datas = WPTB_Helper.replaceAll( datas, 'data-wptb-el-main-table_setting-startedid-0',\n 'data-wptb-el-main-table_setting-' + postId );\n }\n }\n }\n }\n\n let styleObjJson = WPTB_Helper.elementsStylesConvertToObject();\n if( paramIdsNecessaryChange ) {\n styleObjJson = WPTB_Helper.replaceAll( styleObjJson, '.wptb-element-main-table_setting-startedid-0',\n '.wptb-element-main-table_setting-' + postId );\n }\n\n if ( t === '' && code === '' ) {\n let messagingAreaText = '';\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\n messagingArea.classList.add( 'wptb-warning' );\n setTimeout(function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n return;\n }\n\n let params = {\n title: t,\n content: code,\n elements_datas: datas,\n elements_styles: styleObjJson,\n security_code: wptb_admin_object.security_code\n };\n\n\n if( previewSaving ) {\n params.preview_saving = previewSaving;\n }\n\n if ( postId ) {\n params.id = postId;\n }\n params = JSON.stringify( params );\n\n http.open('POST', url, true);\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function ( action ) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n messagingArea = document.getElementById( 'wptb-messaging-area' );\n\n if ( data[0] == 'saved' ) {\n let builderPageUrl = document.location.href.replace( '#', '' );\n let regex = new RegExp( '&table=(.+)', \"i\" );\n builderPageUrl = builderPageUrl.replace( regex, '' );\n window.history.pushState( null, null, builderPageUrl + '&table=' + data[1] );\n\n WPTB_Helper.saveTable( event, true );\n return;\n } else if( data[0] == 'edited' && startSaving ) {\n document.wptbId = data[1];\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\n let wptbPreviewTable = document.querySelector( '.wptb-preview-table' );\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\n if( wptbPreviewBtn.length > 0 ) {\n wptbPreviewBtn = wptbPreviewBtn[0];\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\n }\n\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else if( data[0] == 'edited' ) {\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\n\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else if( data[0] == 'preview_edited' ) {\n return;\n } else {\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\n }\n messagingArea.classList.add( 'wptb-success' );\n setTimeout( function () {\n messagingArea.removeChild( messagingArea.firstChild );\n }, 4000 );\n }\n }\n http.send( params );\n },\n //\n clickOnFreeSpace: function() {\n // if current active section is responsive menu, ignore this functionality\n if(this.getCurrentSection() === 'table_responsive_menu'){\n return;\n }\n\n let cellModeBackground = document.querySelector( '#wptb-cell_mode_background' );\n if( cellModeBackground && cellModeBackground.classList.contains( 'visible' ) ) {\n return;\n }\n // document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\n // document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\n // document.getElementById( 'element-options-group' ).style.display = 'none';\n this.activateSection('elements');\n\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\n }\n let element = document.querySelector( '.wptb-preview-table' );\n if( element ) {\n WPTB_Helper.elementOptionsSet( 'table_setting', element );\n }\n },\n\n /*\n * function for sending of element ajax request\n */\n elementAjax: function( dataAjaxData, element ) {\n let http = new XMLHttpRequest(),\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=wptb_element_ajax\";\n let element_name;\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n element_name = infArr[1];\n }\n\n let params = {\n element_ajax_data: dataAjaxData,\n element_name: element_name,\n security_code: wptb_admin_object.security_code\n };\n params = JSON.stringify( params );\n\n http.open( 'POST', url, true );\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\n\n http.onreadystatechange = function ( action ) {\n if ( this.readyState == 4 && this.status == 200 ) {\n var data = JSON.parse( http.responseText );\n let detail;\n if ( data && Array.isArray( data ) && data[0] == 'element_ajax_responce' ) {\n detail = {value: data[1]};\n } else {\n detail = '';\n }\n WPTB_Helper.wptbDocumentEventGenerate( 'wptb-element:ajax-response', element, detail );\n }\n }\n http.send( params );\n },\n\n /*\n * This just toggles visibility of cell edit bar, and toggles\n * cell selecting mode.\n */\n toggleTableEditMode: function ( close = false ) {\n let bar = document.getElementsByClassName('wptb-edit-bar'),\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\n if (wptbPreviewTable.length > 0) {\n wptbPreviewTable = wptbPreviewTable[0];\n }\n\n if ( bar.length > 0 ) {\n let toggleEditMode = '';\n for ( let i = 0; i < bar.length; i++ ) {\n if ( bar[i].classList.contains( 'visible' ) ) {\n document.select.deactivateMultipleSelectMode();\n bar[i].classList.remove( 'visible' );\n cellModeBackground.classList.remove( 'visible' );\n leftScrollPanelCurtain.classList.remove( 'visible' );\n leftScrollPanelCellSettings.classList.remove( 'visible' );\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\n if ( wptbPreviewTableTds.length > 0 ) {\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\n }\n }\n toggleEditMode = 'closed';\n\n } else if( ! close ) {\n document.select.activateMultipleSelectMode();\n bar[i].classList.add( 'visible' );\n cellModeBackground.classList.add( 'visible' );\n leftScrollPanelCurtain.classList.add( 'visible' );\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\n\n toggleEditMode = 'opened';\n }\n }\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-edit-mode/' + toggleEditMode, wptbPreviewTable)\n }\n },\n\n /*\n * checking of dimension of value\n */\n checkingDimensionValue: function ( value, dimension ) {\n value = String( value );\n dimension = String( dimension );\n if( value && dimension ) {\n let searchIndex = value.indexOf( dimension );\n if ( searchIndex != -1 && searchIndex == ( value.length - dimension.length ) ) {\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n },\n\n /*\n * if dimension is included - checking and if it necessary setting value\n * without dimension - return value\n */\n checkSetGetStyleSizeValue: function( element, styleName, computedStyleName, dimension ) {\n let elemStyleValue = element.style[styleName];\n elemStyleValue = String( elemStyleValue );\n\n if( ! elemStyleValue || dimension ? ! ( WPTB_Helper.checkingDimensionValue( elemStyleValue, dimension ) ) : false ){\n let elementStyles = window.getComputedStyle( element );\n if( computedStyleName && elementStyles.getPropertyValue( computedStyleName ) && dimension ? WPTB_Helper.checkingDimensionValue( elementStyles.getPropertyValue( computedStyleName ), dimension ) : true ) {\n if( ! dimension ) {\n return elementStyles.getPropertyValue( computedStyleName );\n } else {\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\n }\n } else {\n if( ! dimension ) {\n return false;\n } else {\n element.style[styleName] = null;\n }\n }\n } else if( ! dimension ) {\n return elemStyleValue;\n }\n\n return element.style[styleName];\n },\n\n /*\n * function checking that element has the style\n * if this style is present - checking the format color\n * if param set is true - setting style for element (consider hex format of color)\n * if param set is false - getting style from element\n */\n checkSetGetStyleColorValue: function ( element, styleName, computedStyleName, set = false ) {\n let elemStyleColorValue = element.style[styleName];\n\n if( ! elemStyleColorValue ) {\n let elementStyles = window.getComputedStyle( element, null );\n\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\n\n if( set ) {\n elemStyleColorValue = WPTB_Helper.rgbToHex( elementStyles.getPropertyValue( computedStyleName ) );\n if( WPTB_Helper.isHex( elemStyleColorValue ) ) {\n element.style[styleName] = elemStyleColorValue;\n } else {\n element.style[styleName] = '';\n }\n } else {\n return elementStyles.getPropertyValue( computedStyleName );\n }\n\n } else {\n if( set ) {\n element.style[styleName] = '';\n } else {\n return '';\n }\n }\n } else if( ! set ) {\n return elemStyleColorValue;\n }\n },\n\n /*\n * function checking that element has the style\n * if this style is present - checking the format color\n * if param set is true - setting style for element (consider hex format of color)\n * if param set is false - getting style from element\n */\n checkSetGetStyleValue: function ( element, styleName, computedStyleName, set = false ) {\n let elemStyleColorValue = element.style[styleName];\n\n if( ! elemStyleColorValue ) {\n let elementStyles = window.getComputedStyle( element, null );\n\n if( elementStyles && elementStyles.getPropertyValue( computedStyleName ) ) {\n\n if( set ) {\n element.style[styleName] = elementStyles.getPropertyValue( computedStyleName );\n } else {\n return elementStyles.getPropertyValue( computedStyleName );\n }\n\n } else if( ! set ) {\n return '';\n }\n } else if( ! set ) {\n return elemStyleColorValue;\n }\n },\n\n /*\n * get the value of the same elements that have the most count\n */\n getValueMaxCountSameElementsInArray: function ( arr ) {\n if( arr && Array.isArray( arr ) ) {\n let check = {};\n let countEmpty = 0;\n for( let i = 0; i < arr.length; i++ ) {\n if(arr[i]) {\n if( check[arr[i]] ) {\n check[arr[i]]++;\n } else {\n check[arr[i]] = 1;\n }\n } else {\n countEmpty++;\n }\n }\n\n let maxPropName;\n for ( let key in check ) {\n if( ! maxPropName ) {\n maxPropName = key;\n continue;\n } else {\n if( check[maxPropName] < check[key] ) {\n maxPropName = key;\n }\n }\n }\n\n return check[maxPropName] >= countEmpty ? maxPropName : '';\n }\n },\n\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table.\n */\n recalculateIndexes: function ( table ) {\n let trs = table.getElementsByTagName( 'tr' ),\n tds, maxCols = 0, maxColsFull = 0, tdsArr = [];\n\n for ( let i = 0; i < trs.length; i++ ) {\n tds = trs[i].getElementsByTagName( 'td' );\n\n if ( tdsArr[i] == undefined ) {\n tdsArr[i] = [];\n }\n\n let jMainIter = 0;\n for ( let j = 0; j < tds.length; j++ ) {\n if ( tdsArr[i][j] != undefined ) {\n for ( let y = 0; y < 100; y++ ) {\n if ( tdsArr[i][jMainIter] != undefined ) {\n jMainIter++;\n continue;\n }\n tdsArr[i][jMainIter] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n break;\n }\n } else {\n tdsArr[i][j] = tds[j];\n tds[j].dataset.xIndex = jMainIter;\n }\n tds[j].dataset.yIndex = i;\n\n if ( tds[j].colSpan > 1 ) {\n for ( let k = 1; k < tds[j].colSpan; k++ ) {\n jMainIter++;\n tdsArr[i][jMainIter] = 'tdDummy';\n }\n }\n\n if ( tds[j].rowSpan > 1 ) {\n for ( let x = 1; x < tds[j].rowSpan; x++ ) {\n if ( tdsArr[i + x] == undefined ) {\n tdsArr[i + x] = [];\n }\n for ( let z = 0; z < tds[j].colSpan; z++ ) {\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\n }\n }\n }\n jMainIter++;\n }\n\n if ( tds.length > maxCols ) {\n maxCols = tds.length;\n }\n\n if( i == 0 ) {\n maxColsFull = jMainIter;\n }\n }\n table.columns = maxCols;\n table.maxCols = maxColsFull;\n },\n\n /**\n * Table Rows colors reinstall\n */\n tableRowsColorsReinstall: function ( table ) {\n let infArr = table.className.match( /wptb-element-main(.+)-(\\d+)/i );\n if( infArr && Array.isArray( infArr ) ) {\n let tableIndex = '';\n if( infArr[infArr.length -1] == '0' ) {\n tableIndex = 'startedid-0';\n } else {\n tableIndex = infArr[infArr.length -1];\n }\n\n let tableHeaderBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableHeaderBackground' );\n if( tableHeaderBackground ) {\n let details = {value: tableHeaderBackground.value};\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableHeaderBackground, details );\n }\n\n let tableEvenRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableEvenRowBackground' );\n if( tableEvenRowBackground ) {\n let details = {value: tableEvenRowBackground.value};\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableEvenRowBackground, details );\n }\n\n let tableOddRowBackground = document.querySelector('.wptb-el-main-table_setting-' + tableIndex + '-tableOddRowBackground' );\n if( tableOddRowBackground ) {\n let details = {value: tableOddRowBackground.value};\n WPTB_Helper.wptbDocumentEventGenerate( 'controlColor:change', tableOddRowBackground, details );\n }\n }\n },\n /**\n * Get parent html element of given type\n *\n * @param {string} parentType type of parent element\n * @param {HTMLElement} el current element\n * @returns {*} html element of type\n */\n getParentOfType: (parentType, el) => {\n if(el.nodeName === parentType.toUpperCase()) {\n return el;\n }\n\n return WPTB_Helper.getParentOfType(parentType , el.parentElement);\n },\n // current relative type of drag element\n // this type is used on differentiating certain elements based on their positioning on table\n dragRelativeType : '',\n /**\n *\n * @param {string} val drag relative type\n */\n setDragRelativeType: function (val){\n this.dragRelativeType = val;\n },\n // get drag relative type\n getDragRelativeType : function(){\n return this.dragRelativeType;\n },\n /**\n *\n * @param {HTMLElement} element\n * @param {string} styleName\n */\n getElementColorStylesHex: function (element, styleName) {\n let color = element.style[styleName];\n color = WPTB_Helper.rgbToHex( color );\n if( ! WPTB_Helper.isHex( color ) ) {\n color = '';\n }\n return color;\n },\n /**\n * Show element controls on adding them to table.\n */\n showControlsOnElementMount(){\n document.addEventListener('element:mounted:dom', function(e){\n e.target.click();\n });\n },\n /**\n * Show elements list menu on left panel on removing element from table\n */\n showElementsListOnRemove(){\n document.addEventListener('element:removed:dom', function(){\n WPTB_Helper.activateSection('elements');\n })\n }\n}\n","var WPTB_Initializer = function () {\n\n const MIN_COLUMNS = 1,\n MIN_ROWS = 1,\n MAX_COLUMNS = 30,\n MAX_ROWS = 30;\n\n var tableGenerator = document.body;\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\n columnsInput = document.getElementById('wptb-columns-number'),\n rowsInput = document.getElementById('wptb-rows-number');\n \n columnsDecrementButton.onclick = function () {\n if (columnsInput.value > MIN_COLUMNS) {\n columnsInput.value--;\n }\n };\n\n columnsIncrementButton.onclick = function () {\n if (columnsInput.value < MAX_COLUMNS) {\n columnsInput.value++;\n }\n };\n\n rowsDecrementButton.onclick = function () {\n if (rowsInput.value > MIN_ROWS) {\n rowsInput.value--;\n }\n };\n\n rowsIncrementButton.onclick = function () {\n if (rowsInput.value < MAX_ROWS) {\n rowsInput.value++;\n }\n };\n\n document.getElementById( 'wptb-generate-table' ).onclick = function ( ) {\n var columns = document.getElementById('wptb-columns-number').value,\n rows = document.getElementById('wptb-rows-number').value;\n\n //wptbTableStateSaveManager.tableStateClear();\n \n WPTB_Table(columns, rows);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n // register and setup section buttons\n WPTB_Helper.registerSections(['elements', 'table_settings', 'cell_settings', 'options_group' , 'table_responsive_menu']);\n WPTB_Helper.setupSectionButtons();\n\n // activate elements section for startup\n WPTB_Helper.activateSection('elements');\n\n // side bar toggle setup\n // WPTB_Helper.setupSidebarToggle('.wptb-panel-drawer-toggle');\n WPTB_Helper.setupSidebarToggle('.wptb-panel-toggle-section .wptb-panel-drawer-icon');\n\n // setup panel sections that have the ability to be toggled on/off\n WPTB_Helper.setupPanelToggleButtons();\n\n // setup responsive menu both at left and builder panel\n new WptbResponsive('table_responsive_menu', 'wptbResponsiveApp', '.wptb-builder-content');\n\n // get builder section from url parameter for easy switch at page load\n WPTB_Helper.getSectionFromUrl();\n\n // automatically show element controls when dropped to table\n WPTB_Helper.showControlsOnElementMount();\n\n // show elements list menu on left panel on removing elements from table\n WPTB_Helper.showElementsListOnRemove();\n\n};\n","var WPTB_LeftPanel = function () {\r\n\r\n let table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n };\r\n \r\n if( table ) {\r\n let wptbTablesEditModeCloseButton = document.getElementsByClassName( 'wptb-table-edit-mode-close' );\r\n for ( let i = 0; i < wptbTablesEditModeCloseButton.length; i++ ) {\r\n wptbTablesEditModeCloseButton[i].onclick = WPTB_Helper.toggleTableEditMode;\r\n }\r\n };\r\n\r\n // this code hides the \"element parameters\" area\r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.onclick = function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n WPTB_Helper.clickOnFreeSpace();\r\n } \r\n };\r\n \r\n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\r\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\r\n wptbHeader.onclick = function() {\r\n WPTB_Helper.clickOnFreeSpace();\r\n };\r\n};","var MultipleSelect = function () {\n\n\tvar selectedCells = [],\n\t\tmultipleCellMode = false;\n\n\tthis.activateMultipleSelectMode = function () {\n\t\tselectedCells = [];\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\n\t\tfor (var i = 0; i < tds.length; i++) {\n\t\t\ttds[i].classList.remove('wptb-highlighted');\n\t\t}\n\t\tmultipleCellMode = true;\n\t}\n\n\tthis.deactivateMultipleSelectMode = function () {\n\t\tmultipleCellMode = false;\n\t}\n\n\tthis.isActivated = function () {\n\t\treturn multipleCellMode;\n\t}\n\n\tthis.pushSelectedCell = function (cell) {\n\t\tif (!multipleCellMode) {\n\t\t\treturn;\n\t\t}\n\t\tselectedCells.push(cell);\n\t\tcell.classList.add('wptb-highlighted');\n\t};\n\n\tthis.selectedCells = function () {\n\t\treturn selectedCells;\n\t}\n\n\tthis.flushSelectedCells = function () {\n\t\tselectedCells = [];\n\t}\n\n\tthis.getFirst = function () {\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\n\t\t\t\tfirst = selectedCells[i];\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn first;\n\t}\n\n\tthis.getLast = function () {\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\n\t\t\t\tlast = selectedCells[i];\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\n\t\t\t}\n\t\t}\n\t\treturn last;\n\t}\n\n\tthis.removeAllButFirst = function () {\n\t\tvar td = this.getFirst();\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\n\t\t}\n\t}\n\n\treturn this;\n\n};","var WPTB_Parser = function ( code ) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\nif (!Object.keys) {\n Object.keys = (function () {\n 'use strict';\n var hasOwnProperty = Object.prototype.hasOwnProperty,\n hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\n dontEnums = [\n 'toString',\n 'toLocaleString',\n 'valueOf',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'constructor'\n ],\n dontEnumsLength = dontEnums.length;\n\n return function (obj) {\n if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\n throw new TypeError('Object.keys called on non-object');\n }\n\n var result = [], prop, i;\n\n for (prop in obj) {\n if (hasOwnProperty.call(obj, prop)) {\n result.push(prop);\n }\n }\n\n if (hasDontEnumBug) {\n for (i = 0; i < dontEnumsLength; i++) {\n if (hasOwnProperty.call(obj, dontEnums[i])) {\n result.push(dontEnums[i]);\n }\n }\n }\n return result;\n };\n }());\n}","/**\n * Responsive menu and options class.\n *\n * This class will be called and instanced at table builder menu to add it the responsive menu and its controls.\n *\n * @param {string} sectionName section name\n * @param {string} responsiveWrapperId id for mount point\n * @param {string} mainContainerQuery query to find parent container for responsive menu\n * @throws {Error} will throw an error if mainContainerQuery failed to find any element\n * @constructor\n */\n// eslint-disable-next-line no-unused-vars\nfunction WptbResponsive(sectionName, responsiveWrapperId, mainContainerQuery) {\n\tthis.sectionName = sectionName;\n\tthis.responsiveWrapperId = responsiveWrapperId;\n\tthis.responsiveTable = null;\n\tthis.loaded = false;\n\n\t/**\n\t * Add responsive container to dom.\n\t */\n\tthis.addContainerToDom = () => {\n\t\tconst responsiveContainer = document.querySelector(`#${this.responsiveWrapperId}`);\n\t\tif (!responsiveContainer) {\n\t\t\tconst mainContainer = document.querySelector(mainContainerQuery);\n\n\t\t\t// parent container not found, throw error\n\t\t\tif (!mainContainer) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`[WPTB_Responsive]: no parent container is found with the given query of [${mainContainerQuery}]`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst range = document.createRange();\n\t\t\trange.setStart(mainContainer, 0);\n\n\t\t\tconst responsiveElement = range.createContextualFragment(\n\t\t\t\t`<div class=\"wptb-responsive\" id=\"${this.responsiveWrapperId}\">responsive element</div>`\n\t\t\t);\n\t\t\tmainContainer.appendChild(responsiveElement);\n\t\t\tthis.loaded = true;\n\t\t}\n\n\t\tthis.responsiveTable = document.querySelector(`#${this.responsiveWrapperId}`);\n\t};\n\n\t/**\n\t * Load and make necessary mount preparations for component.\n\t */\n\tthis.load = () => {\n\t\tif (!this.loaded) {\n\t\t\tthis.addContainerToDom();\n\n\t\t\tWPTB_Helper.elementStartScript(this.responsiveTable, 'table_responsive_menu');\n\t\t\tWPTB_Helper.elementOptionsSet('table_responsive_menu', this.responsiveTable);\n\t\t\tWPTB_ControlsManager.callControlScript('ResponsiveTable', this.responsiveWrapperId);\n\t\t}\n\t};\n\n\t/**\n\t * Startup hook for the component.\n\t */\n\tthis.startUp = () => {\n\t\t// event listener for section change events\n\t\tdocument.addEventListener('wptbSectionChanged', (e) => {\n\t\t\tconst tablePreview = document.querySelector('.wptb-preview-table');\n\n\t\t\t// check if activated section is related to responsive and there is a main table already in the view\n\t\t\tif (e.detail === this.sectionName && tablePreview) {\n\t\t\t\tthis.load();\n\t\t\t}\n\t\t});\n\n\t\t// event listener for table ready signal\n\t\tdocument.addEventListener('wptb:table:generated', () => {\n\t\t\t// check current section to be sure that responsive menu is the active one before calling load related scripts\n\t\t\tif (WPTB_Helper.getCurrentSection() === 'table_responsive_menu') {\n\t\t\t\tthis.load();\n\t\t\t}\n\t\t});\n\t};\n\n\tthis.startUp();\n}\n","var WPTB_Settings = function () {\n var elems = document.getElementsByClassName('wptb-element');\n\n for ( var i = 0; i < elems.length; i++ ) {\n elems[i].ondragstart = function ( event ) {\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\n\n // set drag relative helper field for future use\n WPTB_Helper.setDragRelativeType(this.dataset.wptbRelativeElements || '');\n }\n elems[i].ondragend = function () {\n WPTB_Helper.elementDragEndClear();\n }\n };\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n \n wptbUndo.onclick = function( event ) {\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\n if(wptbUndoRedoContainer.length > 0) {\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\n wptbUndoRedoContainer.onmouseleave = function( event ) {\n event.target.onmouseleave = '';\n let table = document.querySelector( '.wptb-preview-table' );\n WPTB_Table();\n }\n }\n }\n }\n }\n \n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.onclick = function( event ) {\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\n if(wptbUndoRedoContainer.length > 0) {\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\n wptbUndoRedoContainer.onmouseleave = function( event ) {\n event.target.onmouseleave = '';\n let table = document.querySelector( '.wptb-preview-table' );\n WPTB_Table();\n }\n }\n }\n \n }\n }\n \n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\n }\n }\n \n window.onbeforeunload = function(e) {\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\n if( wptbSaveDisabled.length == 0 ) {\n return true;\n } else {\n return null;\n }\n };\n \n \n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\n }\n \n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\n }\n \n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( event ) {\n if( this.classList.contains( 'wptb-button-disable' ) ) {\n return;\n } \n \n let previewId = Math.floor( Math.random() * 10000 );\n \n var newHref = new URL( event.target.href );\n newHref.searchParams.set( 'preview_id', previewId );\n event.target.href = newHref.toString();\n WPTB_Helper.saveTable( event, false, previewId );\n }\n\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\n if( ! this.classList.contains( 'wptb-save-disabled' ) ) {\n WPTB_Helper.saveTable( event );\n }\n }\n\n let tableTitleField = document.querySelector( '#wptb-setup-name' );\n if( tableTitleField ) {\n tableTitleField.onchange = function () {\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n};\n","var WPTB_Stringifier = function ( codeMain ) {\n if ( codeMain ) {\n let code = codeMain.cloneNode( true );\n code.dataset.tableColumns = codeMain.columns;\n code.style.width = null;\n code.style.minWidth = null;\n code.style.maxWidth = null;\n \n let tds = code.getElementsByTagName( 'td' );\n if ( tds.length > 0 ) {\n for ( let i = 0; i < tds.length; i++ ) {\n\n tds[i].removeAttribute( 'data-x-index' );\n tds[i].removeAttribute( 'data-y-index' );\n tds[i].removeAttribute( 'draggable' );\n tds[i].classList.remove( 'wptb-droppable' );\n let infArr = tds[i].className.match( /wptb-element-((.+-)\\d+)/i );\n if(infArr) tds[i].classList.remove(infArr[0]);\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\n \n if ( innerElements.length > 0 ) {\n for ( let j = 0; j < innerElements.length; j++ ) {\n \n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n \n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n \n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\n if ( contentEditable.length > 0 ) {\n for ( let k = 0; k < contentEditable.length; k++ ) {\n contentEditable[k].removeAttribute( 'contenteditable' );\n }\n }\n \n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\n if ( spellCheck.length > 0 ) {\n for ( let k = 0; k < spellCheck.length; k++ ) {\n spellCheck[k].removeAttribute( 'spellcheck' );\n }\n }\n \n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n \n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\n let wptbActionsLength = wptbActions.length;\n while ( wptbActionsLength > 0 ) {\n if( wptbActions[0] && wptbActions[0].parentNode ) {\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\n wptbActionsLength--;\n } else {\n break;\n }\n \n } \n \n let dataMceBogus = innerElements[j].querySelectorAll( '[data-mce-bogus]' );\n if( dataMceBogus.length > 0 ) {\n dataMceBogus = [...dataMceBogus];\n for( let k = 0; k < dataMceBogus.length; k++ ) {\n if( dataMceBogus[k] && dataMceBogus[k].parentNode ) {\n dataMceBogus[k].parentNode.removeChild( dataMceBogus[k] );\n }\n }\n }\n }\n }\n\n // TODO dataTitleColumnSet\n // if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\n // let columnNameDivContainer = document.createElement( 'div' ),\n // columnNameDiv = document.createElement( 'div' );\n // columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\n // columnNameDiv.classList.add( 'wptb-column-title-mobile' );\n // columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\n // columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\n // color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\n // columnNameDiv.style.padding = tds[i].style.padding;\n // if( tds[i].children.length == 0 ) {\n // tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\n // }\n // columnNameDivContainer.appendChild( columnNameDiv );\n // tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\n // }\n }\n }\n \n return code;\n }\n}","var array = [], WPTB_Table = function ( columns, rows, wptb_preview_table ) {\n\n /* The members of the class */\n var settings = document.getElementsByClassName('wptb-settings-items'),\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\n table, row, cell,\n maxAmountOfCells,\n maxAmountOfRows;\n\n //HERE ARE THE PRIVATE FUNCTIONS\n /*\n * This function toggles buttons visibility in cell edit mode\n * (according to the amount of currently selected cells), and\n * highlights visually the clicked cell if it is not highlighted, or\n * removes highlight if clicked cell is already highlighted. \n * It too toggles the bits of our abstract representation.\n * @param Event this is the event instance of the click performed over a cell.\n */\n var mark = function ( event ) {\n let thisElem = event.currentTarget;\n let rs = thisElem.rowSpan,\n cs = thisElem.colSpan,\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n position = getCoords(thisElem),\n row = position[0],\n column = position[1];\n if ( ! document.select.isActivated() ) {\n return;\n }\n if (thisElem.className.match(/wptb-highlighted/)) {\n thisElem.classList.remove('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 0;\n }\n }\n } else {\n thisElem.classList.add('wptb-highlighted');\n for (var i = 0; i < rs; i++) {\n for (var j = 0; j < cs; j++) {\n array[row + i][column + j] = 1;\n }\n }\n }\n\n let cellHighlighted = document.getElementsByClassName('wptb-highlighted'),\n markedCells = cellHighlighted.length;\n if (markedCells === 0) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n } else if (markedCells === 1) {\n for (var i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.add('visible');\n singleCells[i].removeAttribute('disabled');\n }\n\n cellHighlighted = cellHighlighted[0];\n WPTB_Helper.elementOptionsSet( 'table_cell_setting', cellHighlighted );\n\n let infArr = cellHighlighted.className.match( /wptb-element-((.+-)\\d+)/i );\n\n const controlElemIds = ['cellWidth', 'cellHeight'];\n\n controlElemIds.map(s => {\n let elementControlSizeUnicClass = `wptb-el-${infArr[1]}-${s}`,\n elementControlSizeFixedUnicClass = `wptb-el-${infArr[1]}-${s}Fixed`;\n if(s === 'cellWidth' || s === 'cellHeight') {\n let sizeName = '',\n getSizeFunctionName = '';\n if(s === 'cellWidth') {\n sizeName = 'width';\n getSizeFunctionName = 'getColumnWidth';\n } else if(s === 'cellHeight') {\n sizeName = 'height';\n getSizeFunctionName = 'getRowHeight';\n }\n let size = cellHighlighted.style[sizeName],\n cellSizeInputs = document.querySelectorAll( '.' + elementControlSizeUnicClass ),\n cellSizeFixedInput = document.querySelector( '.' + elementControlSizeFixedUnicClass );\n cellSizeInputs = [...cellSizeInputs];\n\n if(!size && !cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`]) {\n size = WPTB_Helper[getSizeFunctionName](table, cellHighlighted);\n cellSizeInputs.map(s => {\n s.value = size;\n });\n\n cellSizeFixedInput.checked = false;\n } else {\n cellSizeInputs.map(s => {\n if( size ) {\n s.value = parseFloat( size, 10 );\n } else if( cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`] ) {\n s.value = cellHighlighted.dataset[`wptbFixed${sizeName.toUpperCase()}`];\n }\n });\n\n cellSizeFixedInput.checked = true;\n }\n }\n });\n\n cellSettings.classList.add( 'visible' );\n } else {\n for (var i = 0; i < multipleCells.length; i++) {\n if (table.isSquare(array)) {\n multipleCells[i].classList.add('visible');\n multipleCells[i].removeAttribute('disabled');\n } else {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n }\n for (var i = 0; i < noCells.length; i++) {\n noCells[i].classList.remove('visible');\n noCells[i].setAttribute('disabled', 'disabled');\n }\n for (var i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n cellSettings.classList.remove( 'visible' );\n }\n\n /**\n * empty cell setting\n */\n // let emptySetting = document.\n const infArr = thisElem.className.match(/wptb-element-table_cell_setting-((.+-)\\d+)/i);\n if (infArr && infArr.length > 1) {\n const controlKey = 'emptyCell';\n const settingId = `wptb-el-table_cell_setting-${infArr[1]}-${controlKey}`;\n const settingElem = document.getElementById(settingId);\n if (settingElem) {\n settingElem.querySelector('input[type=\"checkbox\"]').checked = thisElem.classList.contains('wptb-empty')\n }\n }\n \n\n let details = {countMarkedCells:markedCells};\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/cell/mark', thisElem, details);\n };\n\n /* \n * This function fills an array with 1's according to the actual design\n * of HTML table.\n * @returns an array of arrays containing an abstract representation\n * of HTML table.\n * @deprecated\n * */\n\n var realTimeArray = function () {\n var carried = [], tds, cols, matriz = [];\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n cols = [];\n\n var tds = table.rows[i].getElementsByTagName('td');\n\n for (items = 0; items < tds.length; items++) {\n\n for (var k = 0; k < tds[items].colSpan; k++) {\n cols.push(1);\n }\n\n if (tds[items].rowSpan > 1) {\n for (var k = 0; k < tds[items].colSpan; k++) {\n carried[items + k] = {\n justAssigned: true,\n amount: tds[items].rowSpan\n };\n }\n }\n }\n\n for (var k = 0; k < maxAmountOfCells; k++) {\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\n carried[k].amount--;\n if (carried[k].justAssigned) {\n carried[k].justAssigned = false;\n } else {\n cols.push(1);\n }\n }\n }\n\n matriz.push(cols);\n\n }\n return matriz;\n };\n\n /*\n * This function gets the number and position of cell spaces in current row that are occuped \n * by upper rowspanned cells.\n * @param number the number of row where we wish to calculate the carried rowspans up to.\n * @return an array with the remaining rowspans in each column.\n */\n var carriedRowspans = function (row) {\n var carried = [], tds, cols;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n carried[i] = 0;\n }\n\n if (row == -1) {\n return carried;\n }\n\n for (var i = 0; i <= row; i++) {\n cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (carried[xPosition]) {\n carried[xPosition]--;\n } else {\n celda = cellsBuffer[cellPointer++];\n if (celda.rowSpan > 1) {\n for (k = 0; k < celda.colSpan; k++) {\n carried[xPosition + k] = celda.rowSpan - 1;\n }\n stepsToMove = celda.colSpan;\n } else if (celda.colSpan > 1) {\n stepsToMove = celda.colSpan;\n }\n }\n }\n\n }\n return carried;\n };\n\n /*\n * A helpful function for showing\n * the abstract table in console.\n * @param Array our abstract table.\n */\n var drawTable = function (a) {\n var string = 'DRAWING TABLE:\\n';\n for (var i = 0; i < a.length; i++) {\n\n for (var j = 0; j < a[i].length; j++) {\n string += ' ' + a[i][j];\n }\n string += '\\n';\n }\n table.isSquare(a);\n };\n\n /*\n * It resets all the bits of our abstract representation\n * to 0 and removes the highlighting class of all cells.\n */\n\n var undoSelect = function () {\n let noCells = document.getElementsByClassName('wptb-no-cell-action'),\n singleCells = document.getElementsByClassName('wptb-single-action'),\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\n tds = table.getElementsByClassName('wptb-highlighted');\n while (tds.length) {\n tds[0].classList.remove('wptb-highlighted');\n }\n cellSettings.classList.remove( 'visible' );\n for (let i = 0; i < array.length; i++) {\n for (let j = 0; j < array[i].length; j++) {\n array[i][j] = 0;\n }\n }\n for (let i = 0; i < multipleCells.length; i++) {\n multipleCells[i].classList.remove('visible');\n multipleCells[i].setAttribute('disabled', 'disabled');\n }\n for (let i = 0; i < noCells.length; i++) {\n noCells[i].classList.add('visible');\n noCells[i].removeAttribute('disabled');\n }\n for (let i = 0; i < singleCells.length; i++) {\n singleCells[i].classList.remove('visible');\n singleCells[i].setAttribute('disabled', 'disabled');\n }\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/undo-select/active', table);\n };\n\n /*\n * This fills the abstract representation of our table with \n * zeros, at the start. the max amount of cells is the greatest sum\n * of all colspans for row.\n */\n\n var fillTableArray = function () {\n var colspansSums = [], a = [];\n\n //calculate max amount of cells inside a row\n for (var i = 0; i < table.rows.length; i++) {\n var cells = table.rows[i].getElementsByTagName('td'),\n colspanSumInRow = 0;\n for (var j = 0; j < cells.length; j++) {\n colspanSumInRow += cells[j].colSpan;\n }\n colspansSums.push(colspanSumInRow);\n }\n\n maxAmountOfCells = Math.max.apply(null, colspansSums);\n //calculate max rows\n var maxAmountOfRows = table.rows.length;\n\n // fill with zeros from both values\n for (var i = 0; i < maxAmountOfRows; i++) {\n a[i] = [];\n for (var j = 0; j < maxAmountOfCells; j++) {\n a[i].push(0);\n }\n }\n drawTable(a);\n return a;\n };\n\n /*\n * This function gets the sum of all colspans in a row.\n * @param number the number of row to be used as reference.\n */\n var getActualPointsInRow = function (row) {\n var tds = table.rows[row].getElementsByTagName('td'),\n points = 0;\n for (var i = 0; i < tds.length; i++) {\n points += tds[i].colSpan;\n }\n return points;\n }\n\n /*\n * This function gets us the exact coordinates of\n * an exact cell, in a more reliable way than xIndex and yIndex,\n * these last ones were meant to be used for getting the cell trough them.\n * @param DOMElement the cell to get the coordinates.\n */\n var getCoords = function (search) {\n var skipInCols = [], cell;\n\n for (var i = 0; i < maxAmountOfCells; i++) {\n skipInCols[i] = 0;\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\n cellPointer = 0;\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\n stepsToMove = 1;\n\n if (skipInCols[xPosition]) {\n skipInCols[xPosition]--;\n } else {\n var td = cellsBuffer[cellPointer++];\n if (td == search) {\n return [i, xPosition];\n }\n if (td.rowSpan > 1) {\n for ( let k = 0; k < td.colSpan; k++ ) {\n skipInCols[xPosition + k] = td.rowSpan - 1;\n }\n stepsToMove = td.colSpan;\n } else if (td.colSpan > 1) {\n stepsToMove = td.colSpan;\n }\n }\n }\n }\n };\n\n jQuery('#wptb-table-border-color').val('');\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\n\n if ( columns || rows ) {\n //END OF PRIVATE FUNCTIONS\n for (var i = 0; i < settings.length; i++) {\n if (settings[i].id !== 'wptb-apply-inner-border') {\n settings[i].classList.add('visible');\n }\n }\n\n //Create a HTML Table element.\n table = document.createElement( 'table' );\n table.classList.add( 'wptb-preview-table', 'wptb-element-main-table_setting-startedid-0' );\n table.style.border = '0px solid';\n table.dataset.reconstraction = 1;\n //table.dataset.wptbAdaptiveTable = 1;\n //Add the data rows.\n for (var i = 0; i < rows; i++) {\n\n row = table.insertRow(-1);\n row.classList.add( 'wptb-row' );\n\n for (var j = 0; j < columns; j++) {\n cell = new WPTB_Cell(mark);\n cell.setCoords(i, j);\n cell.getDOMElement().style.borderWidth = '1px';\n row.appendChild(cell.getDOMElement());\n }\n }\n } else {\n if( ! wptb_preview_table ) wptb_preview_table = document.querySelector( '.wptb-preview-table' );\n\n if ( wptb_preview_table ) {\n table = wptb_preview_table;\n\n let cells = table.getElementsByTagName('td');\n\n if (cells.length > 0) {\n for (let i = 0; i < cells.length; i++) {\n WPTB_Cell(mark, cells[i]);\n }\n }\n } else {\n return;\n }\n }\n\n /**\n * this method run \"mark\" method of WPTB_Table object\n * @param event\n */\n table.mark = (event) => {\n mark(event);\n }\n\n /**\n * this method run \"undoSelect\" method of WPTB_Table object\n * @param event\n */\n table.undoSelect = () => {\n undoSelect();\n }\n\n /**\n * method for set value for maxAmountOfCells\n * @param value\n */\n table.setMaxAmountOfCells = (value) => {\n maxAmountOfCells = value;\n }\n\n /**\n * this method return maxAmountOfCells value\n * @returns {*}\n */\n table.getMaxAmountOfCells = () => {\n return maxAmountOfCells;\n }\n\n /**\n * this method run \"fillTableArray\" method of WPTB_Table object\n * @returns {[]}\n */\n table.fillTableArray = () => {\n return fillTableArray();\n }\n /*\n * For assigning to each cell xIndex and y Index attributes,\n * these are the column number and row number of cell in table. \n */\n\n table.recalculateIndexes = function () {\n WPTB_Helper.recalculateIndexes( this );\n }\n \n table.addColumnWidth = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataXIndex = highlighted[k].dataset.xIndex;\n if( dataXIndex ) {\n function tableTdsFor( dataXIndex, colspan ) {\n let tableRows = table.rows;\n let widthIsSet = false;\n let arrayTdsFromPreviousRow = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.xIndex == dataXIndex ) {\n if( value ) {\n if( td.colSpan == colspan ) {\n td.style.width = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n widthIsSet = true;\n } else {\n td.style.width = null;\n td.dataset.wptbFixedWidth = value;\n if( i == tableRows.length - 1 && ! widthIsSet ) {\n tableTdsFor( dataXIndex, colspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.width = null;\n td.removeAttribute( 'data-wptb-fixed-width' );\n } else {\n if( td.dataset.wptbFixedWidth ) {\n if( td.colSpan == colspan ) {\n td.style.width = td.dataset.wptbFixedWidth + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n } \n } else if( td.style.width ) {\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\n }\n arrayTdsFromPreviousRow = [];\n } else {\n arrayTdsFromPreviousRow.push( td );\n }\n }\n break;\n } \n }\n }\n }\n \n tableTdsFor( dataXIndex, 1 );\n }\n }\n \n table.tdDefaultWidth();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n }\n }\n \n table.tdDefaultWidth = function() {\n let rows = table.rows;\n \n let tableTdsSumMaxWidth = 0;\n let tableTdsSumMaxWidthFixed = 0;\n let tableTdsSumMaxWidthAuto = 0;\n \n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\n \n let arrayCellsWidthFixedHelper = [];\n let arrayCellsWidthAutoHelper = [];\n let tdPaddingCommon = 0;\n let tableTdBorderCommonWidth = 0;\n let cssForTdsWidthAuto = '';\n \n \n let tableFullStyleObj = window.getComputedStyle( table, null );\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\n \n for( let i = 0; i < rows.length; i++ ) {\n let tds = rows[i].children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n \n if( ! arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\n if( td.style.width ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] = parseFloat( td.style.width );\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n } else {\n if( ! td.dataset.wptbFixedWidth ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] = table.dataset.wptbTdWidthAuto ? parseFloat( table.dataset.wptbTdWidthAuto, 10 ) : 100;\n td.dataset.wptbCssTdAutoWidth = true;\n }\n }\n \n if( window.getComputedStyle( td, null ) ) {\n let tdStyleObj = window.getComputedStyle( td, null );\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\n\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\n tableTdBorderCommonWidth = tableTdBorderCommonWidth / 2;\n \n if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n \n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\n }\n\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderRightWidth, 10 ) / 2 ) );\n }\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tdPaddingCommon;\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += tableTdBorderCommonWidth;\n \n if( j == 0 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderLeftWidth, 10 ) / 2;\n } else if( j == 0 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderLeftWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\n }\n\n if( j == tds.length - 1 && ( tableBorderCommon / 2 ) <= parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += parseFloat( tableTdBorderRightWidth, 10 ) / 2;\n } else if( j == tds.length - 1 && ( tableBorderCommon / 2 ) > parseFloat( tableTdBorderRightWidth, 10 ) ) {\n arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] += ( ( tableBorderCommon / 2 ) - ( parseFloat( tableTdBorderLeftWidth, 10 ) / 2 ) );\n }\n }\n }\n } else if( arrayCellsWidthAutoHelper[parseFloat( td.dataset.xIndex )] ) {\n if( ! td.dataset.wptbFixedWidth ) {\n td.dataset.wptbCssTdAutoWidth = true;\n }\n } else if( arrayCellsWidthFixedHelper[parseFloat( td.dataset.xIndex )] ) {\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\n }\n }\n }\n \n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\n if( arrayCellsWidthFixedHelper[i] ) {\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\n }\n }\n \n let CellsWidthAutoCount = 0;\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\n if( arrayCellsWidthAutoHelper[i] ) {\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\n CellsWidthAutoCount++;\n }\n }\n \n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto;\n \n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\n if( CellsWidthAutoCount ) {\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\n if( table.mergingСellsHorizontally ) {\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed;\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n }\n } else {\n table.removeAttribute( 'data-wptb-fixed-width-size' );\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\n }\n \n let styleElementCreate = false;\n let tableTdWidthAuto;\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\n if( CellsWidthAutoCount ) {\n table.style.minWidth = '100%';\n if( table.mergingСellsHorizontally ) {\n table.style.width = 'auto';\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed;\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\n styleElementCreate = true;\n } else {\n table.style.width = '100%';\n }\n } else {\n table.style.width = 'auto';\n table.style.minWidth = null;\n table.style.maxWidth = null;\n }\n } else {\n table.style.maxWidth = null;\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\n table.style.width = 'auto';\n tableTdWidthAuto = table.dataset.wptbTdWidthAuto ? table.dataset.wptbTdWidthAuto : '100';\n styleElementCreate = true;\n }\n \n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n }\n \n if( styleElementCreate ) {\n cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\n if( head ) {\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n \n if( table.dataset.wptbTableAlignment ) {\n let wptbTableAlignment = table.dataset.wptbTableAlignment;\n\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\n if( wptbTableSetupWidth < table.offsetWidth ) {\n table.style.float = null;\n } else {\n if( wptbTableAlignment == 'center' ) {\n table.style.float = null;\n } else {\n table.style.float = wptbTableAlignment;\n }\n }\n\n if( wptbTableAlignment == 'center' ) {\n wptbTableSetup.style.float = null;\n } else {\n wptbTableSetup.style.float = wptbTableAlignment;\n }\n \n if( tableTdWidthAuto && table.dataset.wptbTableContainerMaxWidth && table.offsetWidth < table.dataset.wptbTableContainerMaxWidth ) {\n table.style.width = '100%';\n }\n } else {\n table.style.float = null;\n }\n }\n \n table.addRowHeight = function( value, cleaner ) {\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\n if( highlighted.length > 0 ) {\n for( let k = 0; k < highlighted.length; k++ ) {\n let dataYIndex = highlighted[k].dataset.yIndex;\n if( dataYIndex ) {\n function tableTdsFor( dataYIndex, rowspan ) {\n let tableRows = table.rows;\n let heightIsSet = false;\n let arrayTdsPrevious = [];\n for( let i = 0; i < tableRows.length; i++ ) {\n let row = tableRows[i];\n let tds = row.children;\n for( let j = 0; j < tds.length; j++ ) {\n let td = tds[j];\n if( td.dataset.yIndex == dataYIndex ) {\n if( value ) {\n if( td.rowSpan == rowspan ) {\n td.style.height = value + 'px';\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n heightIsSet = true;\n continue;\n } else {\n td.style.height = null;\n td.dataset.wptbFixedHeight = value;\n if( j == tds.length - 1 && ! heightIsSet ) {\n tableTdsFor( dataYIndex , rowspan + 1 );\n }\n }\n } else if( cleaner ) {\n td.style.height = null;\n td.removeAttribute( 'data-wptb-fixed-heidht' );\n } else {\n if( td.dataset.wptbFixedHeight ) {\n if( td.rowSpan = rowspan ) {\n td.style.height = td.dataset.wptbFixedHeight + 'px';\n td.removeAttribute( 'data-wptb-fixed-width' );\n }\n } else if( td.style.height ) {\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\n arrayTdsPrevious[z].style.height = td.style.height;\n }\n arrayTdsPrevious = [];\n } else {\n arrayTdsPrevious.push( td );\n }\n }\n } \n }\n }\n }\n \n tableTdsFor( dataYIndex, 1 );\n }\n }\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n }\n }\n \n table.reconstraction = function() {\n let tds = table.getElementsByTagName( 'td' );\n table.mergingСellsHorizontally = false;\n table.mergingCellsVertically = false;\n table.dataset.reconstraction = 1;\n let forBreak = 0;\n for( let i = 0; i < tds.length; i++ ) {\n if( tds[i].colSpan > 1 ) {\n table.dataset.reconstraction = 0;\n table.mergingСellsHorizontally = true;\n forBreak++;\n }\n \n if( tds[i].rowSpan > 1 ) {\n table.dataset.reconstraction = 0;\n table.mergingCellsVertically = true;\n forBreak++;\n }\n \n if( forBreak == 2 ) {\n break;\n }\n }\n }\n\n /*\n * As simple as it is: adds a column to the end of table.\n */\n table.addColumnEnd = function () {\n let td,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if (currentTable.length > 0) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if (currentTableTd) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n \n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n \n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');\n }\n \n table.rows[i].appendChild(td.getDOMElement());\n array[i].push(0);\n }\n \n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * As simple as it looks: adds a column to the start of table.\n */\n\n table.addColumnStart = function () {\n let td,\n firstCell,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n if ( currentTable.length > 0 ) {\n currentTableTd = currentTable[0].querySelector('td');\n }\n\n if ( currentTableTd ) {\n currentTdStyle = currentTableTd.getAttribute('style');\n }\n \n for (var i = 0; i < table.rows.length; i++) {\n td = new WPTB_Cell(mark);\n if (currentTdStyle) {\n td.getDOMElement().setAttribute('style', currentTdStyle);\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');\n }\n firstCell = table.rows[i].getElementsByTagName('td')[0];\n if (firstCell) {\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\n } else {\n table.rows[i].appendChild(td.getDOMElement());\n }\n array[i].push(0);\n }\n\n maxAmountOfCells++;\n table.recalculateIndexes();\n table.tdDefaultWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Well, not so simple as previous functions.\n * It adds a column after a certain column of reference.\n * @param integer the column number to be used as reference.\n *\tIf empty, then the first highlighted cell is used as reference.\n */\n\n table.addColumnAfter = function (c_pos) {\n let rows = table.rows,\n cell,\n cellStyle,\n pos;\n\n if(c_pos != undefined && typeof c_pos === 'number') {\n pos = c_pos;\n cell = document.querySelector('[data-x-index=\"' + pos + '\"]');\n } else {\n cell = document.querySelector('.wptb-highlighted');\n pos = getCoords(cell)[1];\n }\n\n if(cell) {\n cellStyle = cell.getAttribute('style');\n\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\n table.addColumnEnd();\n } else {\n for(let i = 0; i < rows.length; i++) {\n let tds = rows[i].children;\n for(let j = 0; j < tds.length; j++) {\n if(parseInt(tds[j].dataset.xIndex) <= pos) {\n if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan == pos + cell.colSpan) {\n let td = newTd(cellStyle);\n let nextSib = tds[j].nextSibling;\n if (nextSib) {\n rows[i].insertBefore(td.getDOMElement(), nextSib);\n } else {\n rows[i].appendChild(td.getDOMElement());\n }\n\n break;\n } else if(parseInt(tds[j].dataset.xIndex) + tds[j].colSpan > pos + cell.colSpan) {\n tds[j].colSpan++;\n if(tds[j].rowSpan > 1) i += tds[j].rowSpan - 1;\n break;\n }\n } else if(parseInt(tds[j].dataset.xIndex) > pos) {\n let td = newTd(cellStyle);\n rows[i].insertBefore(td.getDOMElement(), tds[j]);\n break;\n }\n }\n }\n\n function newTd(cellStyle) {\n let td = new WPTB_Cell(mark);\n if (cellStyle) {\n td.getDOMElement().setAttribute('style', cellStyle);\n td.getDOMElement().style.width = null;\n td.getDOMElement().style.height = null;\n }\n td.getDOMElement().style.borderColor = WPTB_TableSettingsData.getTableSetting('borderColor');\n return td;\n }\n\n for (var i = 0; i < array.length; i++) {\n array[i].push(0);\n }\n maxAmountOfCells++;\n drawTable(array);\n table.recalculateIndexes();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n }\n };\n\n /*\n * For preventing us to take a lot of time,\n * This is just calling the function addColumnAfter, but\n * using the previous column to current one as reference.\n * @see addColumnAfter\n */\n\n table.addColumnBefore = function () {\n var cell = document.querySelector('.wptb-highlighted'),\n pos = getCoords(cell)[1];\n\n if (pos === 0) {\n table.addColumnStart();\n } else {\n table.addColumnAfter(pos - 1);\n }\n };\n\n /*\n * Luckily, thisfunction is simple, \n * it just add a row to the end of table.\n */\n\n table.addRowToTheEnd = function () {\n let r = table.insertRow(-1),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table');\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTable = currentTable[0];\n \n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\n if( currentTableTd ) {\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\n \n td.getDOMElement().setAttribute( 'style', currentTdStyle );\n td.getDOMElement().style.height = null;\n }\n r.appendChild(td.getDOMElement());\n }\n \n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /*\n * Yet another simple function, \n * it just add a row to the start of table.\n */\n\n table.addRowToTheStart = function () {\n let r = table.insertRow(0),\n td,\n aux,\n currentTable = document.getElementsByClassName('wptb-preview-table'),\n currentTableTd,\n currentTdStyle;\n r.classList.add( 'wptb-row' );\n if (currentTable.length > 0) {\n currentTable = currentTable[0];\n \n for (var i = 0; i < maxAmountOfCells; i++) {\n td = new WPTB_Cell(mark);\n let currentTableTd = currentTable.querySelector('[data-x-index=\"' + i + '\"]');\n if( currentTableTd ) {\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\n \n td.getDOMElement().setAttribute( 'style', currentTdStyle );\n td.getDOMElement().style.height = null;\n }\n r.appendChild(td.getDOMElement());\n }\n \n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n };\n\n /* \n * This function adds a row before the current one.\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\n * the most of the troubles is not here.\n */\n\n table.addRowBefore = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellNew;\n for( let i = row - 1; i >= 0; i-- ) {\n let rowChildren = table.rows[i].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for( let j = 0; j < rowChildrenLength; j++ ) {\n if( rowChildren[j].rowSpan == 1 ) {\n row = i;\n cellNew = true;\n break;\n }\n }\n }\n if ( cellNew ) {\n break;\n }\n }\n\n if (row === 0) {\n table.addRowToTheStart();\n } else {\n table.addRowAfter( row, cellStyle );\n }\n };\n\n /*\n * Well... by the name convention of the previous 3 functions,\n * it's pretty obvious that this functions attaches a new\n * row after highlighted cell row. The greatest obstacle it was\n * the possibility of a TR not having the exact amount of columns\n * occuped by actual node but rowspanned upper cells. For that purpose\n * it was created the function realTimeArray.\n * @see realTimeArray\n */\n\n table.addRowAfter = function ( row, cellStyle ) {\n let cellRowSpan,\n rowAfter,\n aux;\n \n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\n let cell = document.querySelector('.wptb-highlighted');\n cellStyle = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n cellRowSpan = cell.rowSpan,\n rowAfter = row + cellRowSpan - 1;\n } else {\n rowAfter = row;\n }\n \n \n let cellsColSpan = 0;\n if ( rowAfter < table.rows.length -1 ) {\n for( let i = 0; i <= rowAfter ; i++ ) {\n let tableRowsIChildren = table.rows[i].children,\n tableRIChildrenLength = tableRowsIChildren.length;\n if( tableRIChildrenLength > 0 ) {\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\n\n if ( rowIRowSpan - 1 + i > rowAfter ) {\n tableRowsIChildren[j].rowSpan++;\n }\n }\n }\n }\n \n let rNext = table.rows[rowAfter + 1],\n rNextChildren = rNext.children,\n rNextChildrenLength = rNextChildren.length;\n \n if( rNextChildrenLength > 0 ) {\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\n cellsColSpan += rNextChildren[i].colSpan;\n }\n }\n } else {\n cellsColSpan = array[0].length;\n }\n \n let r = table.insertRow( rowAfter + 1 );\n r.classList.add( 'wptb-row' );\n \n for ( j = 0; j < cellsColSpan; j++ ) {\n let td = new WPTB_Cell( mark );\n let currentTableTd = table.querySelector('[data-x-index=\"' + j + '\"]');\n if( currentTableTd ) {\n let currentTdStyle = currentTableTd.getAttribute( 'style' );\n\n td.getDOMElement().setAttribute( 'style', currentTdStyle );\n td.getDOMElement().style.height = null;\n }\n r.appendChild( td.getDOMElement() );\n }\n\n aux = Array.from(array[0]);\n array.push(aux);\n drawTable(array);\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n table.addColumnWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after');\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * This function checks the current selected cells\n * make a rectangular shape.\n * @param Array the abstract table.\n * @return false, if not making a rectangle, or\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\n */\n\n table.isSquare = function (a) {\n var rowStart = -1,\n columnStart = -1,\n rowEnd = -1,\n columnEnd = -1,\n height,\n width,\n itemsEstimate = 0,\n items = 0;\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n if ( j < columnStart || columnStart == -1 ) {\n columnStart = j;\n }\n if ( i < rowStart || rowStart == -1 ) {\n rowStart = i;\n }\n }\n }\n \n }\n\n for (var i = a.length - 1; i > -1; i--) {\n for (var j = a[i].length - 1; j > -1; j--) {\n if (a[i][j] == 1) {\n if ( j > columnEnd ) {\n columnEnd = j;\n }\n if ( i > rowEnd ) {\n rowEnd = i;\n }\n }\n }\n }\n\n for (var i = rowStart; i < rowEnd; i++) {\n for (var j = columnStart; j < columnEnd; j++) {\n if (a[i][j] == 0 || a[i][j] == undefined) {\n return false;\n }\n }\n }\n\n for (var i = 0; i < a.length; i++) {\n for (var j = 0; j < a[i].length; j++) {\n if (a[i][j] == 1) {\n items++;\n }\n }\n }\n\n height = rowEnd - rowStart + 1;\n width = columnEnd - columnStart + 1;\n itemsEstimate = height * width;\n\n if (itemsEstimate !== items) {\n return false;\n }\n return [height, width];\n };\n\n /*\n * This function merges all selected cells.\n * Well, actually sets the colspan and rowspan of first \n * upper left cell in selection and deletes the another selected cells.\n */\n\n table.mergeCells = function () {\n var dimensions = table.isSquare(array),\n rowspan = dimensions[0],\n colspan = dimensions[1],\n first = document.querySelector('.wptb-highlighted'),\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\n tdsChildrenNew = [];\n\n for (let i = 0; i < tds.length; i++) {\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\n if (tdsInternalElements.length > 0) {\n let tdsIntElemLength = tdsInternalElements.length;\n for (let j = 0; j < tdsIntElemLength; j++) {\n tdsChildrenNew.push(tdsInternalElements[j]);\n }\n }\n let p = tds[i].parentNode;\n p.removeChild(tds[i]);\n }\n if (tdsChildrenNew.length > 0) {\n for (let i = 0; i < tdsChildrenNew.length; i++) {\n first.appendChild(tdsChildrenNew[i]);\n }\n }\n\n first.colSpan = colspan;\n first.rowSpan = rowspan;\n table.recalculateIndexes();\n table.reconstraction();\n let firstWidth = first.style.width;\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\n if( firstWidth ) {\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\n } else if( firstDataFixedWidth ) {\n table.addColumnWidth();\n } else {\n table.addColumnWidth( false, true );\n }\n \n let firstHeight = first.style.height;\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\n if( firstHeight ) {\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\n } else if( firstDataFixedHeight ) {\n table.addRowHeight();\n } else {\n table.addRowHeight( false, true );\n }\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * This functions makes the exact inverse as above.\n * It resets colspan and rowspan and appends \n * the same amount in cells to the table.\n * @bug\n */\n\n table.splitCell = function () {\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\n rowspan = cell.rowSpan,\n colspan = cell.colSpan,\n cellStyles = cell.getAttribute('style'),\n row = getCoords(cell)[0],\n thisRow = table.rows[row],\n cellXIndex =cell.dataset.xIndex;\n \n cell.rowSpan = 1;\n cell.colSpan = 1;\n \n for (let i = 1; i < colspan; i++) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n td.getDOMElement().classList.add( 'wptb-highlighted' );\n if ( cell.nextSibling ) {\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\n } else {\n thisRow.appendChild( td.getDOMElement() );\n }\n \n }\n\n if (rowspan > 1) {\n for (let i = 1; i < rowspan; i++) {\n let rowChildInsertBefore = undefined,\n rowNext = table.rows[row + i],\n rowChildren = rowNext.children,\n rowChildrenLength = rowChildren.length;\n \n if ( rowChildrenLength > 0 ) {\n for ( let k = 0; k < rowChildrenLength; k++ ) {\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\n rowChildInsertBefore = rowChildren[k];\n break;\n } \n }\n }\n for ( let j = 0; j < colspan; j++ ) {\n let td = new WPTB_Cell( mark );\n td.getDOMElement().setAttribute( 'style', cellStyles );\n if ( rowChildInsertBefore != undefined ) {\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\n } else {\n rowNext.appendChild( td.getDOMElement() );\n }\n }\n }\n }\n\n table.recalculateIndexes();\n table.reconstraction();\n table.addColumnWidth();\n table.addRowHeight();\n WPTB_Helper.dataTitleColumnSet( table );\n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n /*\n * Searches for rowspanned cells up to row number meeting it.\n * @param number the number of row where the function\n * must search up to.\n */\n\n table.findRowspannedCells = function (row) {\n var array = [],\n difference;\n actualPoints = getActualPointsInRow(row);\n if (actualPoints === maxAmountOfCells) {\n return [];\n }\n difference = maxAmountOfCells - actualPoints;\n\n for (var i = row - 1; i >= 0 && difference; i--) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var i = 0; i < tds.length; i++) {\n if (tds[i].rowSpan > 1) {\n array.push(tds[i]);\n difference -= tds[i].colSpan;\n }\n }\n }\n return array;\n\n }\n\n /*\n * This function explores the table and adds \n * a cell for each lacking one for each row\n * to meet an even amount of cells.\n */\n\n table.addLackingCells = function () {\n var sumRows = [];\n for (var i = 0; i < table.rows.length; i++) {\n sumRows.push(0);\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td');\n for (var j = 0; j < tds.length; j++) {\n if (tds[j].rowSpan > 1) {\n for (var k = 1; k < tds[j].rowSpan; k++) {\n sumRows[i + k]++;\n }\n }\n }\n }\n\n for (var i = 0; i < table.rows.length; i++) {\n var tds = table.rows[i].getElementsByTagName('td'),\n totalColspan = 0;\n for (var j = 0; j < tds.length; j++) {\n totalColspan += tds[j].colSpan;\n }\n totalColspan += sumRows[i];\n difference = maxAmountOfCells - totalColspan;\n for (var j = 0; j < difference; j++) {\n var td = new WPTB_Cell(mark);\n table.rows[i].appendChild(td.getDOMElement());\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\n }\n }\n };\n\n /*\n * This function deletes the row of currently\n * selected cell. \n */\n\n table.deleteRow = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellStyles = cell.getAttribute('style'),\n rowspan = cell.rowSpan,\n row = getCoords(cell)[0],\n thisRow,\n aux;\n \n if ( rowspan == undefined ) rowspan = 1;\n \n for ( let i = 0; i < rowspan; i++ ) {\n thisRow = table.rows[row];\n let thisRowChildren = thisRow.children,\n nextRow = table.rows[row + 1],\n nextRowChildren,\n nextRowChildrenLength,\n tdArr = [];\n\n if( nextRow != undefined ) {\n nextRowChildren = nextRow.children;\n nextRowChildrenLength = nextRowChildren.length;\n for (let j = 0; j < thisRowChildren.length; j++) {\n if ( thisRowChildren[j].rowSpan > 1 ) {\n let td = new WPTB_Cell(mark);\n td.getDOMElement().setAttribute('style', cellStyles);\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\n\n let nextRowChildrenK = undefined;\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\n nextRowChildrenK = nextRowChildren[k];\n break;\n } \n }\n\n if ( nextRowChildrenK ) {\n tdArr.push( [td, nextRowChildrenK] );\n } else {\n tdArr.push( [td] );\n }\n }\n }\n\n if ( tdArr.length > 0 ) {\n for ( let k = 0; k < tdArr.length; k++ ) {\n if ( tdArr[k][1] != undefined ) {\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\n } else {\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\n }\n }\n }\n }\n \n let tableRows = table.rows;\n if ( tableRows.length > 0 ) {\n for ( let j = 0; j < row; j++ ) {\n let jRowChildren = tableRows[j].children;\n if ( jRowChildren.length > 0 ) {\n for ( let x = 0; x < jRowChildren.length; x++ ) {\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\n jRowChildren[x].rowSpan--;\n }\n }\n }\n }\n }\n aux = Array.from(array[0]);\n array.pop(aux);\n drawTable(array);\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\n \n if( table.rows.length == 0 ) {\n WPTB_Helper.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n \n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else {\n table.recalculateIndexes();\n WPTB_Helper.tableRowsColorsReinstall( table );\n WPTB_Helper.dataTitleColumnSet( table );\n table.reconstraction();\n }\n }\n \n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n }\n\n /*\n * This function deletes the column of currently\n * selected cell. Again, this is way more complicated than\n * delete row case.\n */\n\n table.deleteColumn = function () {\n let cell = document.querySelector('.wptb-highlighted'),\n cellXIndex = cell.dataset.xIndex,\n colspan = cell.colSpan;\n \n for ( let i = 0; i < colspan; i++ ) {\n for ( let j = 0; j < table.rows.length; j++ ) {\n let rowChildren = table.rows[j].children;\n let rowChildrenLength = rowChildren.length;\n if( rowChildrenLength > 0 ) {\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n } else {\n table.rows[j].removeChild( rowChildren[k] );\n }\n break;\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \n Number( rowChildren[k].dataset.xIndex ) + \n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\n if ( rowChildren[k].colSpan > 1 ) {\n rowChildren[k].colSpan--;\n }\n break;\n }\n }\n }\n }\n \n for ( let j = 0; j < table.rows.length; j++ ) {\n if (array[j] != undefined)\n array[j].pop();\n }\n \n maxAmountOfCells--;\n \n if( table.querySelectorAll( 'td' ).length == 0 ) {\n WPTB_Helper.toggleTableEditMode();\n wptbTableSetup.innerHTML = '';\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n \n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n }\n } else {\n table.recalculateIndexes();\n table.tdDefaultWidth();\n WPTB_Helper.dataTitleColumnSet( table );\n table.reconstraction();\n }\n }\n \n undoSelect();\n\n WPTB_Helper.wptbDocumentEventGenerate('wp-table-builder/table-changed/after', table);\n\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n\n array = fillTableArray();\n\n undoSelect();\n drawTable(array);\n\n wptbTableSetup.appendChild(table);\n //if (columns || rows) {\n table.recalculateIndexes( true );\n //}\n table.reconstraction();\n table.tdDefaultWidth();\n \n wptbTableSetup.onresize = function() {\n table.tdDefaultWidth();\n };\n\n WPTB_LeftPanel();\n\n // event hook to signal that table is generated and ready to be used\n WPTB_Helper.wptbDocumentEventGenerate('wptb:table:generated', document);\n\n WPTB_Helper.elementStartScript( table, 'table_setting' );\n WPTB_Helper.elementOptionsSet( 'table_setting', table );\n \n // this code gets the ID of the active element in the toolbar \n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\n// }\n// }\n// }, false );\n// }\n \n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\n// if( wptbPanelLeft.length > 0 ) {\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }, false );\n// }\n \n// let body = document.getElementsByTagName( 'body' );\n// if( body.length > 0 ) {\n// body[0].addEventListener( 'click', function( e ) {\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\n// document.getElementById( toolbarActiveElementId ).style.display = '';\n// }\n// }, false );\n// }\n};","const WPTB_TableSettingsData = {\n borderColor: '',\n /**\n *\n * @param {string} name\n * @param {string} value\n */\n setTableSetting: function(name, value){\n this[name] = value;\n },\n /**\n *\n * @param {string} name\n * @returns {*}\n */\n getTableSetting: function (name) {\n return this[name];\n }\n}\n\n","var WPTB_TableStateSaveManager = function() {\n this.tableStateSet = ( generate ) => {\n \n if( generate && window.wptbTableStateSaving && Array.isArray( window.wptbTableStateSaving ) ) {\n return;\n }\n \n // get table setup\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n let wptbPreviewTable = '';\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n wptbPreviewTable = wptbTableSetup.querySelector( '.wptb-preview-table' );\n } else {\n wptbTableSetup = '';\n }\n\n\n \n // check if a global array doesn't exist with saved versions of the table \n // them create it\n if( ! window.wptbTableStateSaving && ! Array.isArray( 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 ) {\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\n }\n\n //add new state of table\n let wptbNewTableSetup = '';\n if( wptbTableSetup ) {\n wptbNewTableSetup = wptbTableSetup.cloneNode( true );\n let wptbHighlighted = wptbNewTableSetup.getElementsByClassName( 'wptb-highlighted' );\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\n }\n let wptbDirectlyhovered = wptbNewTableSetup.getElementsByClassName( 'wptb-directlyhovered' );\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\n }\n let mceContentBodys = wptbNewTableSetup.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 let dataMceStyle = wptbNewTableSetup.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 let mceIds = wptbNewTableSetup.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\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 wptbTableTitle = '';\n let wptbSetupName = document.getElementById( 'wptb-setup-name' );\n if( wptbSetupName ) wptbTableTitle = wptbSetupName.value;\n\n window.wptbTableStateSaving.push( [wptbNewTableSetup, cssForTdsWidthAutoValue, wptbTableTitle] );\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 > 0 ) {\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 || ! wptbPreviewTable ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n wptbSaveBtn.classList.add('active');\n }\n }\n }\n \n this.tableStateGet = ( datawptbUndoredo ) => {\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 0 ) {\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 ) {\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 \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 \n // add or delete class \"wptb-save-disabled\" for save button\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 wptbSaveBtn.classList.remove('active');\n } else {\n wptbSaveBtn.classList.add('active');\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.outerHTML = '';\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow] ) {\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] && \n typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] === 'object' ) {\n if( 'outerHTML' in window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] ) {\n wptbTableSetup.outerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][0].outerHTML;\n }\n }\n\n let wptbTableSetupNew = document.querySelector( '.wptb-table-setup' );\n if( wptbTableSetupNew && wptbTableSetupNew.children.length == 0 ) {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n wptbSaveBtn.classList.remove('active');\n } else {\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\n }\n\n // add or change or delete style element in the head for table cells who have auto width\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 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 head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n // change value of table title field\n let wptbSetupName = document.getElementById( 'wptb-setup-name' );\n if( typeof window.wptbTableStateSaving[window.wptbTableStateNumberShow][2] != 'undefined' ) {\n if( wptbSetupName ) wptbSetupName.value = window.wptbTableStateSaving[window.wptbTableStateNumberShow][2];\n }\n }\n \n let body = document.getElementsByTagName( 'body' );\n if( body.length > 0 ) {\n body = body[0];\n }\n\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 \n this.tableStateClear = function() {\n delete window.wptbTableStateSaving;\n delete window.wptbTableStateNumberShow;\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n \n wptbSaveBtn.removeAttribute( 'data-wptb-table-state-number-save' );\n }\n \n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n \n wptbUndo.classList.add( 'wptb-undoredo-disabled' );\n }\n \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}","var WPTB_innerElementSet = function ( element ) {\n \n element.ondragenter = function (e) {\n var div;\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\n return;\n }\n WPTB_DropHandle(this, e);\n \n element.classList.add( 'wptb-ondragenter' );\n }\n element.ondragover = function (e) {\n e.preventDefault();\n WPTB_DropHandle(this, e);\n }\n element.ondragleave = function (e) {\n WPTB_DropHandle(this, e, true);\n\n }\n element.ondrop = function(e) {\n this.classList.remove( 'wptb-ondragenter' );\n let element, classId;\n e.preventDefault();\n e.stopPropagation();\n\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\n return;\n }\n let wptbDropHandle,\n wptbDropBorderMarker;\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\n }\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\n }\n\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\n element = WPTB_Helper.newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\n element = element.getDOMElement();\n } else {\n classId = e.dataTransfer.getData( 'node' );\n element = document.getElementsByClassName( classId )[0];\n //element.classList.remove( 'wptb-moving-mode' );\n }\n\n if(WPTB_Helper.getDragRelativeType() === 'td_relative'){\n WPTB_DropHandle(this, e, true);\n const parentCell = WPTB_Helper.getParentOfType('td', e.target);\n\n parentCell.appendChild(element);\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n\n }else if( wptbDropHandle.style.display == 'block' ) {\n let td;\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\n td = wptbDropHandle.getDOMParentElement();\n td.appendChild( element );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n } else {\n let innerElement = wptbDropHandle.getDOMParentElement();\n td = innerElement.parentNode;\n\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\n td.insertBefore( element, innerElement );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\n let innerElementNext = innerElement.nextSibling;\n td.insertBefore( element, innerElementNext );\n WPTB_Helper.wptbDocumentEventGenerate('element:mounted:dom', element);\n }\n }\n \n let thisRow = td.parentNode;\n if( WPTB_Helper.rowIsTop( thisRow ) ) { \n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n \n if( table.classList.contains( 'wptb-table-preview-head' ) ) {\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n \n // start item javascript if item is new\n let infArr = element.className.match(/wptb-element-(.+)-(\\d+)/i);\n let elemKind = infArr[1];\n if ( e.dataTransfer.getData( 'wptbElement' ) && ( elemKind == 'text' || elemKind == 'button' || elemKind == 'image' || elemKind == 'star_rating' || elemKind == 'list' ) ) {\n //WPTB_Helper.elementStartScript( element );\n }\n } else {\n return;\n }\n\n if(wptbDropHandle){\n wptbDropHandle.style.display = 'none';\n wptbDropBorderMarker.style.display = 'none';\n }\n\n WPTB_innerElementSet( element );\n \n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\n element.classList.remove( 'wptb-moving-mode' );\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n } \n return true;\n }\n element.onmouseover = function(e) {\n element.classList.remove( 'wptb-ondragenter' );\n }\n}","var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\n var node = element.getDOMElement(),\n index,\n copy;\n if( node.classList.contains( 'wptb-ph-element' ) ) {\n if ( kindIndexProt == undefined || copy == true ) {\n //index = document.counter.nextIndex( element.kind );\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\n let elementIndexesArr = [];\n for( let i = 0; i < wptbElements.length; i++ ) {\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\n let infArr = wptbElements[i].className.match( regex );\n if( infArr ) {\n elementIndexesArr.push( infArr[1] );\n }\n }\n if( elementIndexesArr.length > 0 ) {\n let elementIndexMax = Math.max( ...elementIndexesArr );\n index = elementIndexMax + 1;\n } else { \n index = 1;\n }\n\n if( copy ) {\n // change all data-elements which save parameters for different controls\n let wptbNodeattributes = [...node.attributes];\n for( let i = 0; i < wptbNodeattributes.length; i++ ) {\n if( wptbNodeattributes[i] && typeof wptbNodeattributes[i] === 'object' && wptbNodeattributes[i].nodeName ) {\n let regularText = new RegExp( 'data-wptb-el-' + element.kind + '-(\\\\d+)-([a-zA-Z0-9_-]+)', \"i\" );\n let attr = wptbNodeattributes[i].nodeName.match( regularText );\n if( attr && Array.isArray( attr ) ) {\n let newDataAttributeName = wptbNodeattributes[i].nodeName.replace( element.kind + '-' + attr[1], element.kind + '-' + index );\n let newDataAttributeValue = wptbNodeattributes[i].nodeValue;\n node.removeAttribute( wptbNodeattributes[i].nodeName );\n node.setAttribute( newDataAttributeName, newDataAttributeValue );\n }\n }\n }\n }\n } else if ( kindIndexProt && ! copy ) {\n let kindIndexProtArr = kindIndexProt.split('-');\n index = kindIndexProtArr[kindIndexProtArr.length - 1];\n // start element javascript if element is new\n \n }\n\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\n if ( node_wptb_element_kind_num ) {\n node.classList.remove( node_wptb_element_kind_num[0] );\n }\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\n node.classList.add( 'wptb-ph-element' );\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n } else {\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\n }\n }\n WPTB_Helper.elementStartScript( element.getDOMElement() );\n new WPTB_ElementOptions( element, index, kindInd
|