Version Description
- FIX: Image alignment setting not working.
- NEW: Increased maximum number of Rows and Columns.
- IMPROVE: Performance improvement by loading assets only where necessary.
Download this release
Release Info
Developer | imtiazrayhan |
Plugin | WP Table Builder – WordPress Table Plugin |
Version | 1.0.7 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 1.0.7
- inc/admin/class-tables.php +4 -1
- inc/admin/css/admin.css +9 -0
- inc/admin/js/admin.js +61 -56
- inc/admin/js/admin.js.map +1 -1
- inc/admin/js/admin.min.js +1 -1
- inc/admin/js/core/WPTB_ElementOptions.js +59 -55
- inc/admin/js/core/WPTB_Initializer.js +2 -2
- inc/admin/views/builder/wptb-builder-table-setup.php +2 -2
- inc/frontend/class-frontend.php +11 -3
- languages/wp-table-builder.pot +4 -4
- readme.txt +22 -5
- wp-table-builder.php +3 -3
inc/admin/class-tables.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
namespace WP_Table_Builder\Inc\Admin;
|
|
|
4 |
|
5 |
/**
|
6 |
* All the table stuffs.
|
@@ -97,7 +98,9 @@ class Tables {
|
|
97 |
|
98 |
}
|
99 |
|
100 |
-
public function get_table( $args ) {
|
|
|
|
|
101 |
//$uniqueSequence = 't'.substr( md5(time()),0,8 );
|
102 |
$html = get_post_meta( $args['id'] , '_wptb_content_', true );
|
103 |
//$html = json_decode( $html );
|
1 |
<?php
|
2 |
|
3 |
namespace WP_Table_Builder\Inc\Admin;
|
4 |
+
use WP_Table_Builder as NS;
|
5 |
|
6 |
/**
|
7 |
* All the table stuffs.
|
98 |
|
99 |
}
|
100 |
|
101 |
+
public function get_table( $args ) {
|
102 |
+
do_action( 'wptb_frontend_enqueue_style' );
|
103 |
+
do_action( 'wptb_frontend_enqueue_script' );
|
104 |
//$uniqueSequence = 't'.substr( md5(time()),0,8 );
|
105 |
$html = get_post_meta( $args['id'] , '_wptb_content_', true );
|
106 |
//$html = json_decode( $html );
|
inc/admin/css/admin.css
CHANGED
@@ -1312,6 +1312,15 @@ table.wptb-table {
|
|
1312 |
display: block !important;
|
1313 |
max-width: 100%;
|
1314 |
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1315 |
}
|
1316 |
|
1317 |
/*
|
1312 |
display: block !important;
|
1313 |
max-width: 100%;
|
1314 |
position: relative;
|
1315 |
+
margin: auto;
|
1316 |
+
}
|
1317 |
+
|
1318 |
+
.wptb-image-wrapper::after {
|
1319 |
+
content: "";
|
1320 |
+
display: block;
|
1321 |
+
height: 0;
|
1322 |
+
width: 100%;
|
1323 |
+
clear: both;
|
1324 |
}
|
1325 |
|
1326 |
/*
|
inc/admin/js/admin.js
CHANGED
@@ -1108,71 +1108,70 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
|
|
1108 |
} else if (element.kind == 'image') {
|
1109 |
var _affectedEl2 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
|
1110 |
if (_affectedEl2.length > 0) {
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
if (_selectOption[_i2].value == imgAlign) {
|
1123 |
-
_selectOption[_i2].selected = true;
|
1124 |
}
|
1125 |
-
|
|
|
1126 |
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
|
|
|
|
1130 |
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
};
|
1135 |
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
|
1149 |
-
|
1150 |
|
1151 |
-
|
1152 |
-
|
1153 |
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
|
1174 |
-
|
1175 |
-
}
|
1176 |
}
|
1177 |
}
|
1178 |
}
|
@@ -1460,7 +1459,13 @@ var WPTB_ElementOptions = function WPTB_ElementOptions(element, index, kindIndex
|
|
1460 |
this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;
|
1461 |
break;
|
1462 |
case 'image-alignment':
|
1463 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1464 |
break;
|
1465 |
case 'font-size':
|
1466 |
affectedEl.style.fontSize = val + 'px';
|
@@ -1997,8 +2002,8 @@ var WPTB_Initializer = function WPTB_Initializer() {
|
|
1997 |
|
1998 |
var MIN_COLUMNS = 1,
|
1999 |
MIN_ROWS = 1,
|
2000 |
-
MAX_COLUMNS =
|
2001 |
-
MAX_ROWS =
|
2002 |
|
2003 |
var tableGenerator = document.body;
|
2004 |
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');
|
1108 |
} else if (element.kind == 'image') {
|
1109 |
var _affectedEl2 = document.getElementsByClassName('wptb-element-' + kindIndexProt);
|
1110 |
if (_affectedEl2.length > 0) {
|
1111 |
+
var elementsA = _affectedEl2[0].getElementsByTagName('a');
|
1112 |
+
if (elementsA.length > 0) {
|
1113 |
+
var a = elementsA[0];
|
1114 |
+
|
1115 |
+
if (a) {
|
1116 |
+
// set select according to the alignment of the image
|
1117 |
+
var imgAlign = void 0;
|
1118 |
+
if (a.style.float == 'none') {
|
1119 |
+
imgAlign = 'center';
|
1120 |
+
} else {
|
1121 |
+
imgAlign = a.style.float;
|
|
|
|
|
1122 |
}
|
1123 |
+
var imageAlignmentSelect = prop.querySelector('select[data-type="image-alignment"]'),
|
1124 |
+
_selectOption = imageAlignmentSelect.getElementsByTagName('option');
|
1125 |
|
1126 |
+
for (var _i2 = 0; _i2 < _selectOption.length; _i2++) {
|
1127 |
+
if (_selectOption[_i2].value == imgAlign) {
|
1128 |
+
_selectOption[_i2].selected = true;
|
1129 |
+
}
|
1130 |
+
}
|
1131 |
|
1132 |
+
a.onclick = function (e) {
|
1133 |
+
e.preventDefault();
|
1134 |
+
};
|
|
|
1135 |
|
1136 |
+
// set text link for input field of setting panel
|
1137 |
+
var imageLinkHref = a.getAttribute('href'),
|
1138 |
+
inputImageLink = prop.querySelector('input[data-type="image-link"]');
|
1139 |
+
if (imageLinkHref) {
|
1140 |
+
inputImageLink.value = imageLinkHref;
|
1141 |
+
}
|
1142 |
|
1143 |
+
// set checkbox for target of link
|
1144 |
+
var imageLinkTarget = a.getAttribute('target'),
|
1145 |
+
imageLinkTargetInput = prop.querySelector('input[data-type="image-link-target"]'),
|
1146 |
+
imageLinkTargetInputId = imageLinkTargetInput.getAttribute('id'),
|
1147 |
+
imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName('label')[0];
|
1148 |
|
1149 |
+
imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split('-')[1];
|
1150 |
|
1151 |
+
imageLinkTargetInput.setAttribute('id', imageLinkTargetInputId);
|
1152 |
+
imageLinkTargetInputLabel.setAttribute('for', imageLinkTargetInputId);
|
1153 |
|
1154 |
+
if (imageLinkTarget && imageLinkTarget == '_blank') {
|
1155 |
+
imageLinkTargetInput.checked = true;
|
1156 |
+
}
|
1157 |
|
1158 |
+
// set value for input fields of image size
|
1159 |
+
var imgWidth = a.style.width;
|
1160 |
+
if (imgWidth) {
|
1161 |
+
var imageWidthInputRange = prop.querySelector('input[type="range"][data-type="image-size"]'),
|
1162 |
+
imageWidthInputNumber = prop.querySelector('input[type="number"][data-type="image-size"]');
|
1163 |
|
1164 |
+
imageWidthInputRange.value = parseInt(imgWidth);
|
1165 |
+
imageWidthInputNumber.value = parseInt(imgWidth);
|
1166 |
+
}
|
1167 |
|
1168 |
+
var img = a.getElementsByTagName('img');
|
1169 |
+
if (img.length > 0) {
|
1170 |
+
// set value for input field of alternative text image
|
1171 |
+
var imgAlternativeText = img[0].getAttribute('alt'),
|
1172 |
+
imageAlternativeTextInput = prop.querySelector('input[type="text"][data-type="alternative-text"]');
|
1173 |
|
1174 |
+
imageAlternativeTextInput.value = imgAlternativeText;
|
|
|
1175 |
}
|
1176 |
}
|
1177 |
}
|
1459 |
this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;
|
1460 |
break;
|
1461 |
case 'image-alignment':
|
1462 |
+
var wptbImageFloatValue = '';
|
1463 |
+
if (this.value == 'center') {
|
1464 |
+
wptbImageFloatValue = 'none';
|
1465 |
+
} else {
|
1466 |
+
wptbImageFloatValue = this.value;
|
1467 |
+
}
|
1468 |
+
affectedEl.querySelector('.wptb-image-wrapper a').style.float = wptbImageFloatValue;
|
1469 |
break;
|
1470 |
case 'font-size':
|
1471 |
affectedEl.style.fontSize = val + 'px';
|
2002 |
|
2003 |
var MIN_COLUMNS = 1,
|
2004 |
MIN_ROWS = 1,
|
2005 |
+
MAX_COLUMNS = 30,
|
2006 |
+
MAX_ROWS = 30;
|
2007 |
|
2008 |
var tableGenerator = document.body;
|
2009 |
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');
|
inc/admin/js/admin.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["applyGenericItemSettings.js","wptb-builder.js","WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Button.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Image.js","WPTB_Initializer.js","WPTB_innerElementSet.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_TableStateSaveManager.js","WPTB_Text.js"],"names":["applyGenericItemSettings","element","kindIndexProt","copy","node","getDOMElement","index","listItems","undefined","document","counter","nextIndex","kind","wptbElements","getElementsByClassName","elementIndexesArr","i","length","regex","RegExp","infArr","className","match","push","elementIndexMax","Math","max","split","onmouseenter","event","target","classList","contains","wptbActionsField","WPTB_ActionsField","addActionField","setParameters","remove","a","querySelector","onclick","e","preventDefault","WPTB_Helper","buttonsTinyMceInit","tinyMCE","init","childNodes","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","row","findAncestor","table","dataTitleColumnSet","onblur","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","init_instance_callback","editor","window","currentEditor","totalWidth","offsetWidth","getElementById","scrollTop","bodyElement","style","display","position","right","top","listItemsTinyMceInit","onmouseleave","wptbActions","type","leaveFromField","observer","MutationObserver","mutations","config","attributes","attributeFilter","observe","node_wptb_element_kind_num","add","WPTB_ElementOptions","increment","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","parentNode","removeChild","btnDelete","btnCopy","btnMove","createElement","draggable","appendChild","act","el","thisRow","actionsRemove","activeElement","activeElementClone","cloneNode","td","temp","srcList","querySelectorAll","innerHTML","WPTB_List","insertBefore","nextSibling","WPTB_Text","WPTB_Image","text","WPTB_Button","WPTB_innerElementSet","ondragstart","dragImagesArr","dataTransfer","effectAllowed","setDragImage","setData","actionsHide","previous","append","wptbDirectlyhovered","action","item","parent","listItemsRecalculateIndex","coordinatesElement","getBoundingClientRect","coordinatesElementTopBegin","listItem","content","html","duplicate","WPTB_ListItem","firstChild","divcontent","setTimeout","coordinatesElementTopEnd","wptbContainer","correctTop","parseFloat","removeEventListener","left","clientWidth","addEventListener","relatedTarget","localName","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","DOMElementProt","DOMElement","elButton","el_B","el_BDiv","el_BDivP","wptbElementMutch","Array","isArray","attributesContainer","setAttribute","name","wptbButtonWrapper","wptbButtonWrapAttributes","wptbButtonA","wptbButtonAttributes","wptbButton","WPTB_Cell","callback","highlightRow","parentRow","columnCount","parseInt","tds","classToAdd","ttd","highlightColumn","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","wptbListItems","setCoords","y","x","dataset","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","height","offsetHeight","WPTB_DropHandle","thisElem","newElementProxy","includes","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","ondragenter","ondragover","ondragleave","ondrop","getData","wptbMovingMode","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","console","log","onscroll","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","key","elemIdClass","prop","properties","affectedEl","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","wptbImageWrapper","imgAlign","textAlign","imageAlignmentSelect","elementsA","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","imgWidth","imageWidthInputRange","imageWidthInputNumber","img","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","optionsClass","children","buttons","size","n_Class","num","optionControls","wpColorPicker","change","ui","classe","ps","number","toString","wpColorPickerCheckChangeForTableStateSaving","slider","oninput","onchange","src","alt","href","linkHttpCheckChange","rel","removeAttribute","jc","id","parentNodeSettingItem","onmouseup","hexToRgb","hex","result","exec","rgb","slice","getDragImageCustom","hostName","location","protocol","hostname","image","button","list","ulElem","par","listStyleTypeIndex","Number","article","keyCode","innerText","pText","replace","trim","selectedText","getSelectionText","wptbListItem","wptbButtonContainer","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","contentsForHeader","tdElements","textContent","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","elementOptionsPanelClear","elementOptionsGroup","originalEvent","wpPickerContainer","irisSquareHandle","uiSliderHandle","attribute","isId","input","newInput","url","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","elImage","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","imgSrc","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","div","classId","stopPropagation","onmouseover","wptbElementButtons","wptbTdBgColorSavedSet","inputId","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","clear","tableHeader","tableAdaptiveForMobile","wptbAdaptiveTableCheckbox","wptbAdaptiveTable","tableTopRowAsHeadSavedSet","wptbTopRowAsHeader","tableBorderColorWidthSavedSet","tableBorderColor","borderColor","tableBorderColorInput","tableBorderWidth","borderWidth","wptbTableBorderWidthSlider","wptbTableBorderWidthNumber","tableTd","applyInnerBorder","innerBorderCheckInput","wptbApplyInnerBorder","wptbTableInnerBorderSlider","wptbTableInnerBorderNumber","tableCells","tableInnerborderNumber","addInnerBorderSize","borderStyle","addCellPadding","addInnerBorder","styles","wptbPreviewTable","marginBottom","addBorderSize","cellPaddingSavedSet","wptbTableCellSlider","wptbTableCellNumber","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","clickOnFreeSpace","wptbHeader","wpcdFixedToolbar","hasAttribute","innerElements","el_L","wptbListItemReturn","styleDot","listItemKeyListener","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","ondragend","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","elSpaceBetween","spaceBetween","t_space","spaceParent","alert","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","k","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","wptbAdaptiveTableChoseBlock","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","l","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","onresize","wptbTableStateSaving","wptbNewPreviewTable","wptbHighlighted","cssForTdsWidthAutoValue","datawptbUndoredo","wptbLeftScrollPanelCellSetting","elText2","elP"],"mappings":"AAAA,IAAIA,2BAA2B,SAA3BA,wBAA2B,CAAWC,OAAX,EAAoBC,aAApB,EAAkD;AAAA,QAAfC,IAAe,uEAAR,KAAQ;;AAC7E,QAAIC,OAAOH,QAAQI,aAAR,EAAX;AAAA,QACIC,KADJ;AAAA,QAEIC,SAFJ;AAAA,QAGIJ,IAHJ;;AAKA,QAAKD,iBAAiBM,SAAjB,IAA8BL,QAAQ,IAA3C,EAAkD;AAC9C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vB,CAAjB;AAAA,QACI4sB,UAAUhzB,SAASoG,aAAT,CAAuB,KAAvB,CADd;AAAA,QAEI6sB,MAAMjzB,SAASoG,aAAT,CAAuB,GAAvB,CAFV;AAAA,QAGI3G,gBAAgBM,SAHpB;AAAA,QAIIL,OAAO,KAJX;;AAMIoM,eAAWxK,SAAX,CAAqB+D,GAArB,CAA0B,qBAA1B;;AAEA4tB,QAAI/rB,SAAJ,GAAgBM,QAAQzH,SAAR,GAAoByH,IAApB,GAA2B,MAA3C;AACAwrB,YAAQ1sB,WAAR,CAAoB2sB,GAApB;AACAnnB,eAAWxF,WAAX,CAAuB0sB,OAAvB;AACJ,QAAKnnB,cAAL,EAAsB;AAClB,YAAIM,mBAAmBN,eAAejL,SAAf,CAAyBC,KAAzB,CAAgC,0BAAhC,CAAvB;AACA,YAAKsL,oBAAoBC,MAAMC,OAAN,CAAeF,gBAAf,CAAzB,EAA6D;AACzD1M,4BAAgB0M,iBAAiB,CAAjB,CAAhB;AACAzM,mBAAO,IAAP;AACH;;AAED,YAAIuF,0CAAiB4G,eAAe5G,UAAhC,EAAJ;AACA,aAAK,IAAI1E,IAAI,CAAb,EAAgBA,IAAI0E,WAAWzE,MAA/B,EAAuCD,GAAvC,EAA6C;AACzCuL,uBAAWS,YAAX,CAAwBtH,WAAW1E,CAAX,EAAciM,IAAtC,EAA4CvH,WAAW1E,CAAX,EAAcyK,KAA1D;AACH;AACJ;;AAED,SAAK7K,IAAL,GAAY,MAAZ;AACA,SAAKP,aAAL,GAAqB,YAAY;AAC7B,eAAOkM,UAAP;AACH,KAFD;AAGAvM,6BAA0B,IAA1B,EAAgCE,aAAhC,EAA+CC,IAA/C;;AAEA,WAAO,IAAP;AACH,CAhCD","file":"admin.js","sourcesContent":["var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\r\n var node = element.getDOMElement(),\r\n index,\r\n listItems,\r\n copy;\r\n \r\n if ( kindIndexProt == undefined || copy == true ) {\r\n index = document.counter.nextIndex( element.kind );\r\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\r\n let elementIndexesArr = [];\r\n for( let i = 0; i < wptbElements.length; i++ ) {\r\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\r\n let infArr = wptbElements[i].className.match( regex );\r\n if( infArr ) {\r\n elementIndexesArr.push( infArr[1] );\r\n }\r\n }\r\n if( elementIndexesArr.length > 0 ) {\r\n let elementIndexMax = Math.max( ...elementIndexesArr );\r\n index = elementIndexMax + 1;\r\n } else { \r\n index = 1;\r\n }\r\n } else if ( kindIndexProt && ! copy ) {\r\n index = kindIndexProt.split('-')[1];\r\n }\r\n \r\n node.onmouseenter = function ( event ) {\r\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\r\n return;\r\n }\r\n \r\n let i, wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n node.classList.remove( 'wptb-ondragenter' );\r\n \r\n //wptbActionsField.addActionField( 1, node )\r\n \r\n if ( element.kind === 'button' ) {\r\n let a = node.querySelector( 'a' ),\r\n target = a.querySelector( 'div' );\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n WPTB_Helper.buttonsTinyMceInit( target );\r\n } else if (element.kind === 'text') {\r\n tinyMCE.init({\r\n target: node.childNodes[0],\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup : function( ed ) {\r\n ed.on( 'change', function(e) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n \r\n });\r\n \r\n ed.on( 'keydown', function(e) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n });\r\n ed.on( 'keyup', function(e) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n \r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n //editor.fire('focus');\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n \r\n } else {\r\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\r\n for ( let i = 0; i < listItems.length; i++ ) {\r\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\r\n }\r\n }\r\n\r\n \r\n };\r\n \r\n node.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n if( wptbActionsField.wptbActions && wptbActionsField.wptbActions.type != '1' ) {\r\n return;\r\n }\r\n \r\n wptbActionsField.leaveFromField( event, node, 1 );\r\n };\r\n \r\n let wptbActions = document.getElementsByClassName( 'wptb-actions' );\r\n if( wptbActions.length > 0 ) {\r\n wptbActions = wptbActions[0];\r\n \r\n }\r\n \r\n // Change data-title-column if the title was changed\r\n if( element.kind == 'text' ) {\r\n var observer = new MutationObserver( function( mutations ) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n });\r\n var config = { attributes: true, attributeFilter: ['style'] };\r\n observer.observe( element.getDOMElement(), config );\r\n }\r\n\r\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if ( node_wptb_element_kind_num ) {\r\n node.classList.remove( node_wptb_element_kind_num[0] );\r\n }\r\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\r\n node.classList.add( 'wptb-ph-element' );\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n } else {\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n }\r\n new WPTB_ElementOptions( element, index, kindIndexProt );\r\n\r\n document.counter.increment(element.kind);\r\n};","","var WPTB_ActionsField = function() {\n //this.wptbBorderMarker;\n this.wptbActions;\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n \n this.addActionField = ( actionType, thisNode ) => {\n let body = document.getElementsByTagName( 'body' )[0];\n \n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length != 0 ) {\n let previousNode = actions[0].activeElem;\n if( previousNode ) {\n previousNode.classList.remove( 'wptb-directlyhovered' );\n }\n \n while( actions.length != 0 ) {\n actions[0].parentNode.removeChild( actions[0] );\n }\n }\n \n if( actionType == 1 ) {\n \n let btnDelete, btnCopy, btnMove;\n\n btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n btnMove = document.createElement( 'span' ),\n actions = document.createElement( 'div' );\n\n actions.classList.add( 'wptb-actions' );\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\n btnMove.draggable = true;\n\n actions.appendChild( btnMove );\n actions.appendChild( btnCopy );\n actions.appendChild( btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n\n actions.type = 1;\n\n btnDelete.onclick = function( event ) {\n let act = event.target.parentNode.activeElem,\n el = act.parentNode;\n el.removeChild(act);\n\n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.actionsRemove();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n\n\n btnCopy.onclick = ( event ) => {\n let copy,\n infArr,\n type;\n let activeElement = event.target.parentNode.activeElem;\n let activeElementClone = activeElement.cloneNode( true );\n activeElementClone.classList.remove( 'wptb-directlyhovered' );\n infArr = activeElement.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n let td = activeElement.parentNode;\n if ( type == 'list' ) {\n var temp = [],\n srcList = activeElement.querySelectorAll('ul li .wptb-list-item-content');\n\n for (var i = 0; i < srcList.length; i++) {\n temp.push(srcList[i].innerHTML);\n }\n\n copy = new WPTB_List( temp, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'text' ) {\n copy = new WPTB_Text( activeElementClone.childNodes[0].innerHTML, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'image' ) {\n copy = new WPTB_Image( '', activeElement );\n \n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else {\n let text = activeElementClone.childNodes[0].querySelector( 'p' ).innerHTML;\n\n copy = new WPTB_Button( text, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n }\n\n WPTB_innerElementSet( copy.getDOMElement() );\n\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\n \n wptbActionsField.setParameters( activeElement );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnMove.ondragstart = ( event ) => {\n let dragImagesArr = WPTB_Helper.dragImagesArr(),\n actions = event.target.parentNode,\n activeElem = actions.activeElem,\n infArr,\n type;\n infArr = activeElem.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n activeElem.classList.add( 'wptb-moving-mode' );\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.activeElem;\n if( act.kind == 'text' ) {\n let thisRow = act.parentNode.parentNode;\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n //actions.style.display = 'none';\n this.actionsHide();\n };\n\n //actions.style.right = '-' + parseFloat( thisNode.offsetWidth ) + 'px';\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n } else if( actionType == 2 ) {\n let btnDelete,\n btnCopy,\n previous,\n i;\n\n btnDelete = document.createElement('span'),\n btnCopy = document.createElement('span'),\n actions = document.createElement('span')\n\n actions.classList.add('wptb-actions');\n btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');\n btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');\n\n actions.append( btnCopy, btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n \n let wptbDirectlyhovered = WPTB_Helper.findAncestor( thisNode, 'wptb-directlyhovered' );\n if( wptbDirectlyhovered ) {\n wptbDirectlyhovered.classList.remove( 'wptb-directlyhovered' );\n }\n\n actions.type = 2;\n\n btnDelete.onclick = ( event ) => {\n var action = event.target.parentNode, \n item = action.activeElem,\n parent = item.parentNode;\n let wptbActionsField = new WPTB_ActionsField( 4 );\n wptbActionsField.actionsRemove();\n parent.removeChild( item );\n WPTB_Helper.listItemsRecalculateIndex( parent );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnCopy.onclick = ( event ) => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopBegin = coordinatesElement.top;\n\n var listItem = event.target.parentNode.activeElem,\n content = listItem.querySelector( '.wptb-list-item-content' ),\n html = content.innerHTML;\n var duplicate = new WPTB_ListItem( html, listItem, true );\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), thisNode.nextSibling );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n\n let divcontent = thisNode.getElementsByClassName( 'wptb-list-item-content' );\n if( divcontent.length > 0 ) {\n divcontent = divcontent[0];\n }\n setTimeout( function(){\n divcontent.innerHTML = html;\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\n }, 5 );\n\n coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopEnd = coordinatesElement.top;\n\n if( coordinatesElementTopBegin != coordinatesElementTopEnd ) {\n let wptbActionsField = new WPTB_ActionsField( 2, thisNode );\n wptbActionsField.setParameters( thisNode );\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n }\n }\n \n this.setParameters = ( thisNode ) => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.display = 'block';\n }\n \n let coordinatesElement = thisNode.getBoundingClientRect();\n \n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\n let correctTop = () => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n }\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\n \n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\n\n// let wptbBorderMarkerTop = this.wptbBorderMarker.querySelector( '.wptb-border-marker-top' );\n// wptbBorderMarkerTop.style.width = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerRight = this.wptbBorderMarker.querySelector( '.wptb-border-marker-right' );\n// wptbBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 4 ) + 'px';\n// wptbBorderMarkerRight.style.left = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerBottom = this.wptbBorderMarker.querySelector( '.wptb-border-marker-bottom' );\n// wptbBorderMarkerBottom.style.width = wptbBorderMarkerTop.style.width;\n// wptbBorderMarkerBottom.style.top = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 3 ) + 'px';;\n//\n// let wptbBorderMarkerLeft = this.wptbBorderMarker.querySelector( '.wptb-border-marker-left' );\n// \n \n //this.wptbBorderMarker.style.display = 'block';\n this.wptbActions.style.display = 'block';\n thisNode.classList.add( 'wptb-directlyhovered' );\n \n wptbContainer.addEventListener( 'scroll', correctTop, false );\n }\n \n// if( actionType == 1 || actionType == 2 ) {\n// this.setParameters( thisNode );\n// }\n// } else {\n// this.wptbActions.style.display = 'block';\n// thisNode.classList.add( 'wptb-directlyhovered' );\n// }\n \n this.leaveFromField = ( event, node, actionType ) => {\n if( event.relatedTarget ) {\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\n if( ! this.wptbActions ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n this.wptbActions.onmouseleave = ( event ) => {\n if( event.relatedTarget != null && event.relatedTarget != this.wptbActions.activeElem &&\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered') != this.wptbActions.activeElem ) {\n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n\n if( this.wptbActions.type == 2 ) {\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\n\n wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\n }\n } else {\n return;\n }\n }\n\n return;\n } \n// else if( event.relatedTarget.classList.contains( 'wptb-drop-handle' ) ) {\n// let wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' );\n// if( wptbDropHandle.length > 0 ) {\n// wptbDropHandle = wptbDropHandle[0];\n// wptbDropHandle.onmouseleave\n// }\n// }\n }\n \n node.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n \n if( this.wptbActions.type == 2 ) {\n if( event.relatedTarget ) {\n if( event.relatedTarget.localName == 'ul' ) {\n //let wptbActionsField = new WPTB_ActionsField();\n\n this.addActionField( 1, event.relatedTarget.parentNode );\n\n this.setParameters( event.relatedTarget.parentNode );\n }\n }\n \n }\n }\n \n this.actionsRemove = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.parentNode.removeChild( this.wptbActions );\n }\n }\n \n this.actionsHide = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.opacity = 0;\n }\n }\n}","(function () {\r\n var WPTB_Builder = function () {\r\n var table_id = WPTB_Helper.detectMode();\r\n if ( table_id ) {\r\n var http = new XMLHttpRequest(),\r\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\r\n http.open('GET', urlSet, true);\r\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\r\n http.onreadystatechange = function (d) {\r\n if (this.readyState == 4 && this.status == 200) {\r\n var ans = JSON.parse(http.responseText);\r\n document.getElementById('wptb-setup-name').value = ans[0];\r\n \r\n if( ans[1] ) {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\r\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\r\n WPTB_Table();\r\n WPTB_LeftPanel();\r\n WPTB_Settings();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n return;\r\n }\r\n };\r\n http.send(null);\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n document.counter = new ElementCounters();\r\n document.select = new MultipleSelect();\r\n\r\n var initializer = WPTB_Initializer();\r\n settings = WPTB_Settings();\r\n };\r\n\r\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\r\n})();","var WPTB_Button = function( text, DOMElementProt ) {\r\n \r\n var DOMElement = document.createElement('div'),\r\n elButton = document.createElement('div'),\r\n el_B = document.createElement('a'),\r\n el_BDiv = document.createElement( 'div' ),\r\n el_BDivP = document.createElement( 'p' ),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n\r\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\r\n elButton.classList.add('wptb-button-wrapper');\r\n el_BDiv.classList.add('wptb-button');\r\n el_BDivP.innerHTML = text != undefined ? text : 'Button Text';\r\n \r\n // Creation of a new button when copying to avoid errors when assigning new event handlers.\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n }; \r\n var attributesContainer = [...DOMElementProt.attributes];\r\n if ( attributesContainer.length > 0 ) {\r\n for( let i = 0; i < attributesContainer.length; i++ ) {\r\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\r\n } \r\n }\r\n \r\n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\r\n if ( wptbButtonWrapper ) {\r\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\r\n if ( wptbButtonWrapAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\r\n if ( wptbButtonWrapAttributes[i].name == 'style') {\r\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButtonA = DOMElementProt.querySelector( 'a' );\r\n if ( wptbButtonA ) {\r\n var wptbButtonAttributes = [...wptbButtonA.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style' || \r\n wptbButtonAttributes[i].name == 'href' || \r\n wptbButtonAttributes[i].name == 'target' ) {\r\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButton = DOMElementProt.querySelector( '.wptb-button' );\r\n if ( wptbButton ) {\r\n var wptbButtonAttributes = [...wptbButton.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style') {\r\n el_BDiv.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n elButton.appendChild(el_B);\r\n el_B.appendChild( el_BDiv );\r\n el_BDiv.appendChild( el_BDivP );\r\n DOMElement.appendChild(elButton);\r\n \r\n \r\n \r\n this.kind = 'button';\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n \r\n return this;\r\n};","var WPTB_Cell = function (callback, DOMElement) {\r\n\r\n function highlightRow(td) {\r\n var parentRow = td.parentNode,\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\r\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\r\n }\r\n for (var i = 0; i < columnCount; i++) {\r\n\r\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\r\n var ttd = parentRow.getElementsByTagName('td')[i];\r\n if (ttd !== td) {\r\n ttd.classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n\r\n function highlightColumn(td) {\r\n\r\n var index,\r\n parentRow = td.parentNode;\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\r\n for (var i = 0; i < columnCount; i++) {\r\n if (parentRow.getElementsByTagName('td')[i] === td) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n for (var i = 0; i < rowCount; i++) {\r\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\r\n var tr = table.getElementsByTagName('tr')[i];\r\n if (tr.getElementsByTagName('td')[index] !== td) {\r\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n \r\n if( ! DOMElement ) {\r\n DOMElement = document.createElement(\"td\");\r\n\r\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\r\n\r\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\r\n\r\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\r\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\r\n } \r\n\r\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\r\n }\r\n\r\n DOMElement.draggable = false;\r\n if ( callback ) {\r\n DOMElement.onclick = callback;\r\n }\r\n \r\n WPTB_innerElementSet( DOMElement );\r\n \r\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( wptbPhElement.length > 0 ) {\r\n for( let i = 0; i < wptbPhElement.length; i++ ) {\r\n\r\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\r\n\r\n if ( wptbSpaceBetween.length > 0 ) {\r\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\r\n WPTB_Space( wptbSpaceBetween[j] );\r\n }\r\n }\r\n \r\n wptbPhElement[i].getDOMElement = function() {\r\n return wptbPhElement[i];\r\n }\r\n \r\n WPTB_innerElementSet( wptbPhElement[i] );\r\n \r\n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\r\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\r\n wptbPhElement[i].kind = wptbTypeElementArr[0];\r\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\r\n if ( wptbPhElement[i].kind == 'list' ) {\r\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\r\n if( wptbListItems.length > 0 ) {\r\n for ( let i = 0; i < wptbListItems.length; i++ ) {\r\n WPTB_ListItem( undefined, wptbListItems[i] );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n this.setCoords = function (y, x) {\r\n var el = this.getDOMElement();\r\n el.dataset.yIndex = y;\r\n el.dataset.xIndex = x;\r\n };\r\n\r\n this.getCoords = function () {\r\n var coords,\r\n el = this.getDOMElement();\r\n coords.x = el.dataset.xIndex;\r\n coords.y = el.dataset.yIndex;\r\n return coords;\r\n };\r\n\r\n this.appendElement = function (node) {\r\n getDOMElement().appendChild(node);\r\n };\r\n \r\n DOMElement.getCellDimensions = function() {\r\n let tdStyleObj = window.getComputedStyle( this, null );\r\n \r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n \r\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n \r\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\r\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\r\n \r\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\r\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\r\n \r\n let width = parseFloat( this.offsetWidth, 10 ) - \r\n parseFloat( tdPaddingLeft, 10 ) - \r\n parseFloat( tdPaddingRight, 10 ) -\r\n parseFloat( tdBorderLeftWidth, 10 ) -\r\n parseFloat( tdBorderRightWidth, 10 );\r\n \r\n let height = parseFloat( this.offsetHeight, 10 ) - \r\n parseFloat( tdPaddingTop, 10 ) - \r\n parseFloat( tdPaddingBottom, 10 ) -\r\n parseFloat( tdBorderTopWidth, 10 ) -\r\n parseFloat( tdBorderBottomWidth, 10 );\r\n \r\n return {\r\n width: width, \r\n height: height\r\n };\r\n }\r\n\r\n return this;\r\n};","var WPTB_DropHandle = function (thisElem, e) {\r\n \r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n \r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\r\n wptbDropHandle = document.createElement( 'div' );\r\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\r\n \r\n wptbDropBorderMarker = document.createElement( 'div' );\r\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\r\n \r\n let wptbDropBorderMarkerTop = document.createElement( 'div' ),\r\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\r\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\r\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\r\n \r\n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\r\n \r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\r\n \r\n let body = document.getElementsByTagName( 'body' );\r\n if ( body.length > 0 ) {\r\n body[0].appendChild( wptbDropHandle );\r\n body[0].appendChild( wptbDropBorderMarker );\r\n }\r\n \r\n wptbDropHandle.ondragenter = function () {\r\n\r\n }\r\n\r\n wptbDropHandle.ondragover = function (e) {\r\n e.preventDefault();\r\n }\r\n\r\n wptbDropHandle.ondragleave = function () {\r\n\r\n }\r\n wptbDropHandle.ondrop = function (e) {\r\n e.preventDefault();\r\n let element;\r\n \r\n if ( e.dataTransfer.getData('wptbElement') ) {\r\n element = newElementProxy( e.dataTransfer.getData('wptbElement') );\r\n element = element.getDOMElement();\r\n } else {\r\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\r\n element.classList.remove( 'wptb-moving-mode' );\r\n element.classList.remove( 'wptb-moving-into-same-elem' );\r\n element.wptbMovingMode = 1;\r\n }\r\n \r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n thisElem = wptbDropHandle.getDOMParentElement();\r\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n }\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n \r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n \r\n WPTB_innerElementSet(element);\r\n console.log(element);\r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n element.wptbMovingMode == undefined;\r\n }\r\n }\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n wptbContainer.onscroll = function() {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n } else {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\r\n return;\r\n }\r\n \r\n let thisRow;\r\n if ( thisElem.localName == 'td' ) {\r\n thisRow = thisElem.parentNode;\r\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\r\n thisRow = thisElem.parentNode.parentNode;\r\n }\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let indics = e.dataTransfer.types;\r\n let notDragEnter = false;\r\n for ( let i = 0; i < indics.length; i++ ) {\r\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\r\n if ( infArr && infArr[1] != 'text' ) {\r\n notDragEnter = true;\r\n break;\r\n }\r\n }\r\n if( notDragEnter ) {\r\n return;\r\n }\r\n }\r\n \r\n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\r\n let height = thisElem.offsetHeight,\r\n coordinatesElement = thisElem.getBoundingClientRect(),\r\n left = parseFloat( coordinatesElement.left ),\r\n top;\r\n wptbDropHandle.style.left = left + 'px';\r\n \r\n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\r\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\r\n if( thisElem == elementDrag ) {\r\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\r\n } else {\r\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\r\n }\r\n }\r\n \r\n wptbDropHandle.getDOMParentElement = function() {\r\n return thisElem;\r\n }\r\n \r\n wptbDropHandle.style.display = 'block';\r\n wptbDropBorderMarker.style.display = 'block';\r\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\r\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\r\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\r\n wptbDropHandle.dataset.text = 'Above Element';\r\n if ( y > height/2 ) {\r\n top = parseFloat( coordinatesElement.top ) + height - 1;\r\n wptbDropHandle.dataset.text = 'Below Element';\r\n }\r\n } else {\r\n wptbDropHandle.dataset.text = 'Drop Here';\r\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\r\n }\r\n wptbDropHandle.style.top = top + 'px';\r\n\r\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\r\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\r\n\r\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\r\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\r\n\r\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\r\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\r\n\r\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\r\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\r\n}","var ElementCounters = function () {\r\n\r\n\tvar priv = [];\r\n\tpriv['text'] = 0;\r\n\tpriv['image'] = 0;\r\n\tpriv['list'] = 0;\r\n\tpriv['button'] = 0;\r\n\r\n\tthis.increment = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpriv[key]++;\r\n\t}\r\n\r\n\tthis.nextIndex = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn priv[key] + 1;\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\r\n\r\n var node = element.getDOMElement(), elemIdClass;\r\n\r\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\r\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\r\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\r\n\r\n var properties = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < properties.length; i++) {\r\n properties[i].dataset.element = elemIdClass;\r\n }\r\n\r\n prop.classList.add(elemIdClass);\r\n document.getElementById(\"element-options-group\").appendChild(prop);\r\n \r\n if ( kindIndexProt ) {\r\n if ( element.kind == 'button' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\r\n wptbButtonWrapper,\r\n wptbButtonA,\r\n wptbButton,\r\n wptbSize;\r\n \r\n if ( affectedEl ) {\r\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\r\n }\r\n \r\n if( wptbSize && Array.isArray( wptbSize ) ) {\r\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\r\n \r\n for ( var i = 0; i < b.length; i++ ) {\r\n b[i].classList.remove( 'selected' );\r\n \r\n if ( b[i].innerHTML == wptbSize[1] ) {\r\n b[i].classList.add( 'selected' );\r\n }\r\n }\r\n }\r\n \r\n if( affectedEl ) {\r\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\r\n \r\n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\r\n \r\n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\r\n }\r\n \r\n if ( wptbButtonWrapper ) {\r\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\r\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\r\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\r\n selectOptionVal;\r\n \r\n if ( buttonAlignment == 'flex-start' ) {\r\n selectOptionVal = 'left';\r\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\r\n selectOptionVal = 'center';\r\n } else if ( buttonAlignment == 'flex-end' ) {\r\n selectOptionVal = 'right';\r\n }\r\n \r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == selectOptionVal ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n }\r\n \r\n if ( wptbButtonA.length > 0 ) {\r\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \r\n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\r\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\r\n \r\n \r\n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\r\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\r\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\r\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\r\n \r\n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\r\n\r\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\r\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\r\n\r\n buttonHrefInput.value = buttonHref;\r\n\r\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\r\n buttonLinkTargetInput.checked = true;\r\n }\r\n \r\n buttotIdInput.value = buttonId;\r\n }\r\n \r\n if( wptbButton ) {\r\n let buttonTextColor = wptbButton[0].style.color,\r\n buttonColor = wptbButton[0].style.backgroundColor,\r\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\r\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\r\n \r\n \r\n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\r\n \r\n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\r\n \r\n }\r\n } else if ( element.kind == 'image' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n \r\n let wptbImageWrapper = affectedEl[0].getElementsByClassName( 'wptb-image-wrapper' );\r\n if( wptbImageWrapper.length > 0 ) {\r\n wptbImageWrapper = wptbImageWrapper[0];\r\n \r\n // set select according to the alignment of the image\r\n let imgAlign = wptbImageWrapper.style.textAlign,\r\n imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\r\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\r\n\r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == imgAlign ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n \r\n \r\n let elementsA = wptbImageWrapper.getElementsByTagName( 'a' );\r\n if ( elementsA.length > 0 ) {\r\n let a = elementsA[0];\r\n\r\n if ( a ) {\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n\r\n // set text link for input field of setting panel\r\n let imageLinkHref = a.getAttribute( 'href' ),\r\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\r\n if ( imageLinkHref ) {\r\n inputImageLink.value = imageLinkHref;\r\n }\r\n\r\n // set checkbox for target of link \r\n let imageLinkTarget = a.getAttribute( 'target' ),\r\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\r\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\r\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\r\n\r\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n\r\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\r\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\r\n\r\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\r\n imageLinkTargetInput.checked = true;\r\n }\r\n\r\n // set value for input fields of image size\r\n let imgWidth = a.style.width;\r\n if ( imgWidth ) {\r\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\r\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\r\n\r\n imageWidthInputRange.value = parseInt( imgWidth );\r\n imageWidthInputNumber.value = parseInt( imgWidth );\r\n }\r\n\r\n let img = a.getElementsByTagName( 'img' );\r\n if ( img.length > 0 ) {\r\n // set value for input field of alternative text image\r\n let imgAlternativeText = img[0].getAttribute('alt'),\r\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\r\n\r\n imageAlternativeTextInput.value = imgAlternativeText;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n } else if ( element.kind == 'text' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n let elementFontSize = affectedEl[0].style.fontSize,\r\n elementTextColor = affectedEl[0].style.color;\r\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\r\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\r\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\r\n\r\n textFontSizeInputRange.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\r\n textFontSizeInputNumber.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\r\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\r\n }\r\n } else if ( element.kind == 'list' ) {\r\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( elementList.length > 0 ) {\r\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\r\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\r\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\r\n \r\n let elementListItem = elementList[0].querySelectorAll( 'li' );\r\n if ( elementListItem.length > 0 ) {\r\n let listItemP = elementListItem[0].querySelector( 'p' );\r\n let listItemPClasses = listItemP.classList;\r\n //listItemPClasses = [...listItemPClasses];\r\n if ( listItemPClasses.length > 0 ) {\r\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\r\n if ( elementListClassSelect ) {\r\n elementListClassSelect.value = 'unordered';\r\n \r\n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\r\n for ( let i = 0; i < 10; i++ ) {\r\n if ( listIconSelectLabel.nodeType == '1' ) {\r\n break;\r\n } else {\r\n listIconSelectLabel = listIconSelectLabel.nextSibling;\r\n }\r\n }\r\n if ( listIconSelectLabel ) {\r\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\r\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\r\n listIconSelectLabel.style.display = 'flex';\r\n }\r\n \r\n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\r\n if ( elementListStyleTypeSelect ) {\r\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\r\n \r\n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\r\n elementListStyleTypeSelect.value = 'disc';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\r\n elementListStyleTypeSelect.value = 'circle';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\r\n elementListStyleTypeSelect.value = 'square';\r\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\r\n elementListStyleTypeSelect.value = 'none';\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\r\n if ( elementListItemContent.length > 0 ) {\r\n let listItemPTextAlignArr = [];\r\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\r\n let p = elementListItemContent[i].querySelector( 'p' );\r\n if ( p ) {\r\n if ( p.style.textAlign ) {\r\n listItemPTextAlignArr.push( p.style.textAlign );\r\n } else {\r\n listItemPTextAlignArr.push( 'left' );\r\n }\r\n }\r\n \r\n }\r\n \r\n let listItemPTextAlignLeftCount = 0,\r\n listItemPTextAlignCenterCount = 0,\r\n listItemPTextAlignRightCount = 0;\r\n \r\n if ( listItemPTextAlignArr.length > 0 ) {\r\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\r\n if ( listItemPTextAlignArr[i] ) {\r\n if ( listItemPTextAlignArr[i] == 'left' ) {\r\n listItemPTextAlignLeftCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\r\n listItemPTextAlignCenterCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\r\n listItemPTextAlignRightCount++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\r\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\r\n \r\n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'left';\r\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'center';\r\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'right';\r\n }\r\n }\r\n } \r\n }\r\n }\r\n\r\n node.onclick = function () {\r\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\r\n optionsClass = '.wptb-' + infArr[2] + 'options' +\r\n '.wptb-options-' + infArr[1];\r\n\r\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\r\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\r\n document.getElementById(\"element-options-group\").style.display = 'block';\r\n\r\n var children = document.getElementById(\"element-options-group\").childNodes;\r\n for (var i = 0; i < children.length; i++) {\r\n if (children[i].style)\r\n children[i].style.display = 'none';\r\n }\r\n\r\n document.querySelector(optionsClass).style.display = 'block';\r\n\r\n //var listStyleType, textAlign;\r\n\r\n// switch (element.kind) {\r\n\r\n// case 'text':\r\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\r\n// prop.querySelector('[type=number][data-type=font-size]').value\r\n// = prop.querySelector('[type=range][data-type=font-size]').value\r\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\r\n// break;\r\n// case 'list':\r\n// textAlign = node.querySelector('li p').style.textAlign;\r\n// listStyleType = node.querySelector('li').style.listStyleType;\r\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\r\n// console.log(textAlign);\r\n// console.log(listStyleType);\r\n// console.log(listStyleType);\r\n// console.log(prop);\r\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\r\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\r\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\r\n// }\r\n// break;\r\n// case 'image':\r\n// break;\r\n// case 'button':\r\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\r\n// break;\r\n//\r\n// }\r\n };\r\n\r\n if (element.kind == 'button') {\r\n //We must add this special kind of property, since it is triggered with click event\r\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\r\n\r\n for (var i = 0; i < buttons.length; i++) {\r\n buttons[i].onclick = function () {\r\n var size = this.innerHTML,\r\n n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\r\n affectedEl.classList.remove('wptb-size-S');\r\n affectedEl.classList.remove('wptb-size-M');\r\n affectedEl.classList.remove('wptb-size-L');\r\n affectedEl.classList.remove('wptb-size-XL');\r\n affectedEl.classList.add('wptb-size-' + size);\r\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\r\n for (var i = 0; i < b.length; i++) {\r\n b[i].classList.remove('selected');\r\n }\r\n this.classList.add('selected');\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n\r\n var optionControls = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < optionControls.length; i++) {\r\n if (optionControls[i].classList.contains('wptb-color-picker')) {\r\n jQuery(optionControls[i]).wpColorPicker({\r\n change: function (event, ui) {\r\n var parent = event.target, classe, type, ps, number;\r\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\r\n type = classe[1];\r\n number = classe[2];\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];\r\n if ( type == 'button' ) {\r\n if (parent.dataset.type == 'button-text-color') {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.color = ui.color.toString();\r\n } else {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();\r\n }\r\n } else if( type == 'list' ) {\r\n let ps = affectedEl.querySelectorAll( 'p' );\r\n if( ps.length > 0 ) {\r\n for ( let i = 0; i < ps.length; i++ ) {\r\n ps[i].style.color = ui.color.toString();\r\n }\r\n }\r\n } else {\r\n affectedEl.style.color = ui.color.toString();\r\n }\r\n \r\n //console.log(event);\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n }\r\n });\r\n }\r\n\r\n if ( optionControls[i].dataset.type === 'font-size' ) {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange( event );\r\n }\r\n }\r\n\r\n if (optionControls[i].dataset.type === 'image-size') {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange( event );\r\n }\r\n }\r\n\r\n optionControls[i].onchange = function ( event ) {\r\n var n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\r\n val = this.value;\r\n\r\n switch ( this.dataset.type ) {\r\n case 'src':\r\n var img = affectedEl.getElementsByTagName(\"img\")[0];\r\n img.src = this.value;\r\n break;\r\n case 'alternative-text':\r\n var img = affectedEl.getElementsByTagName('img')[0];\r\n img.alt = this.value;\r\n break;\r\n case 'image-link':\r\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n break;\r\n case 'image-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'image-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\r\n }\r\n break;\r\n case 'image-size':\r\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\r\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;\r\n break;\r\n case 'image-alignment':\r\n affectedEl.getElementsByClassName( 'wptb-image-wrapper' )[0].style.textAlign = this.value;\r\n break;\r\n case 'font-size':\r\n affectedEl.style.fontSize = val + 'px';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0].value = this.value;\r\n break;\r\n case 'button-alignment':\r\n var jc = '';\r\n if (this.value == 'left') {\r\n jc = 'start';\r\n } else if (this.value == 'right') {\r\n jc = 'flex-end';\r\n } else {\r\n jc = 'center';\r\n }\r\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\r\n break;\r\n case 'button-link':\r\n if ( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\r\n }\r\n break;\r\n case 'button-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'button-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\r\n }\r\n break;\r\n case 'button-id':\r\n if( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\r\n }\r\n case 'button-color':\r\n break;\r\n case 'list-alignment':\r\n let listItems = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItems.length; i++) {\r\n let p = listItems[i].querySelector( 'p' );\r\n if ( p ) {\r\n p.style.textAlign = this.value;\r\n }\r\n }\r\n break;\r\n case 'list-class':\r\n let parentNode = event.target\r\n .parentNode\r\n .parentNode\r\n .querySelector('[data-type=list-style-type]')\r\n .parentNode,\r\n parentNodeSettingItem = parentNode.parentNode;\r\n if (val == 'unordered') {\r\n parentNode.style.display = 'flex';\r\n \r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\r\n let listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-disc' );\r\n }\r\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\r\n } else {\r\n parentNode.style.display = 'none';\r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n }\r\n }\r\n break;\r\n case 'list-style-type':\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\r\n }\r\n break;\r\n }\r\n \r\n \r\n if( event.target.classList.contains( 'wptb-text-font-size-slider' ) || event.target.classList.contains( 'wptb-image-size-slider' ) ) {\r\n event.target.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n } else {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n};","var WPTB_Helper = {\r\n hexToRgb: function( hex ) {\r\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\r\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\r\n },\r\n rgbToHex: function ( rgb ) {\r\n var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\r\n\r\n return ( rgb && rgb.length === 4 ) ? \"#\" +\r\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\r\n },\r\n getDragImageCustom: function ( type ) {\r\n let hostName = location.protocol + '//' + location.hostname;\r\n let img = document.createElement( 'img' );\r\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\r\n return img;\r\n },\r\n dragImagesArr: function() {\r\n return {\r\n text: WPTB_Helper.getDragImageCustom( 'text' ),\r\n image: WPTB_Helper.getDragImageCustom( 'image' ),\r\n button: WPTB_Helper.getDragImageCustom( 'button' ),\r\n list: WPTB_Helper.getDragImageCustom( 'list' )\r\n };\r\n },\r\n listItemsRecalculateIndex: function( ulElem ) {\r\n let par = ulElem.querySelectorAll( 'p' );\r\n if ( par.length > 0 ) {\r\n for ( let i = 0; i < par.length; i++ ) {\r\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\r\n }\r\n }\r\n },\r\n listItemsTinyMceInit: function( listItem ) {\r\n tinyMCE.init({\r\n target: listItem,\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup: function(ed) {\r\n ed.on('keydown', function(e) {\r\n let article = e.target.parentNode;\r\n if ( e.keyCode == 13 ) {\r\n e.preventDefault();\r\n let text = e.target.innerHTML;\r\n let duplicate = new WPTB_ListItem( text, article, true );\r\n \r\n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\r\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\r\n e.target.querySelector( 'p' ).innerText = 'New List Item';\r\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\r\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\r\n \r\n return;\r\n \r\n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\r\n let p = e.target.querySelector( 'p' );\r\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\r\n pText = pText.replace( /\\s+/g, ' ' ).trim();\r\n pText = pText.replace( / /g, '').trim();\r\n \r\n if( pText == '' ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n } else {\r\n let selectedText = WPTB_Helper.getSelectionText();\r\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\r\n selectedText = selectedText.replace( / /g, '' ).trim();\r\n if( selectedText == pText ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n }\r\n }\r\n }\r\n \r\n let wptbListItem = e.target.parentNode;\r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 2, wptbListItem );\r\n\r\n wptbActionsField.setParameters( wptbListItem );\r\n });\r\n \r\n ed.on( 'keyup', function( e ) {\r\n let wptbListItem = e.target.parentNode;\r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 2, wptbListItem );\r\n\r\n wptbActionsField.setParameters( wptbListItem );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n buttonsTinyMceInit: function( target ) {\r\n tinyMCE.init({\r\n target: target,\r\n inline: true,\r\n plugins: \"link\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n toolbar: 'bold italic strikethrough',\r\n setup : function(ed) {\r\n ed.on( 'keydown', function(e) {\r\n if (e.keyCode == 13) {\r\n e.preventDefault();\r\n }\r\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 1, wptbButtonContainer );\r\n\r\n wptbActionsField.setParameters( wptbButtonContainer );\r\n });\r\n \r\n ed.on( 'keyup', function(e) {\r\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 1, wptbButtonContainer );\r\n\r\n wptbActionsField.setParameters( wptbButtonContainer );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n linkHttpCheckChange: function( link ) {\r\n if ( link ) {\r\n if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\r\n let linkArr = link.split( '/' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n return document.location.protocol + '//' + linkClean;\r\n } else { \r\n return link;\r\n }\r\n } else {\r\n return '';\r\n }\r\n },\r\n dataTitleColumnSet: function( table ) {\r\n let rows = table.rows,\r\n rowHead = rows[0];\r\n let computedStyleRowHead = getComputedStyle(rowHead);\r\n \r\n let rowHeadChildren = rowHead.children;\r\n let contentsForHeader = {};\r\n for( let i = 0; i < rowHeadChildren.length; i++ ) {\r\n let tdElements = rowHeadChildren[i].children;\r\n for( let j = 0; j < tdElements.length; j++ ) {\r\n let element = tdElements[j];\r\n if( element.classList.contains( 'wptb-ph-element' ) ) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr[1] == 'text' ) {\r\n let p = element.querySelector( 'p' ),\r\n textContent = p.textContent,\r\n textAlign = p.style.textAlign;\r\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, \r\n element.style.color, computedStyleRowHead.backgroundColor, textAlign];\r\n break;\r\n }\r\n }\r\n }\r\n if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\r\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', \r\n '', computedStyleRowHead.backgroundColor, ''];\r\n }\r\n }\r\n for ( let i = 1; i < rows.length; i++ ) {\r\n let thisRow = rows[i],\r\n thisRowChildren = thisRow.children;\r\n for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\r\n thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\r\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\r\n thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\r\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\r\n thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\r\n } else {\r\n thisRowChildren[j].dataset.wptbTitleColumn = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnColor = '';\r\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = '';\r\n thisRowChildren[j].dataset.wptbTitleAlign = '';\r\n }\r\n }\r\n }\r\n },\r\n findAncestor: function(el, cls) {\r\n while ((el = el.parentElement) && !el.classList.contains(cls));\r\n return el;\r\n },\r\n getSelectionText: function() {\r\n var txt = '';\r\n if (txt = window.getSelection) {\r\n txt = window.getSelection().toString();\r\n } else {\r\n txt = document.selection.createRange().text;\r\n }\r\n return txt;\r\n },\r\n settingsPanelClear: function() {\r\n document.getElementById( 'wptb-adaptive-table-checkbox' ).checked = false;\r\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\r\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\r\n document.getElementById( 'wptb-table-border-number' ).value = 0;\r\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\r\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color', true );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg', true );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg', true );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg', true );\r\n \r\n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\r\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\r\n },\r\n elementOptionsPanelClear: function() {\r\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\r\n if( elementOptionsGroup ) {\r\n elementOptionsGroup.innerHTML = '';\r\n }\r\n },\r\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\r\n if( event.originalEvent.type == 'external' ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n if( event.originalEvent.type == 'square' ) {\r\n let irisSquareHandle = wpPickerContainer.getElementsByClassName( 'iris-square-handle' );\r\n if( irisSquareHandle.length > 0 ) {\r\n irisSquareHandle = irisSquareHandle[0];\r\n irisSquareHandle.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n } else if( event.originalEvent.type == 'strip' ) {\r\n let uiSliderHandle = wpPickerContainer.getElementsByClassName( 'iris-slider-offset' );\r\n if( uiSliderHandle.length > 0 ) {\r\n uiSliderHandle = uiSliderHandle[0];\r\n uiSliderHandle.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n wpColorPickerClear: function( attribute, isId ) {\r\n let input;\r\n if( isId ) {\r\n input = [document.getElementById( attribute )];\r\n input.length = 1;\r\n } else {\r\n input = document.getElementsByClassName( attribute );\r\n }\r\n for( let i = 0; i < input.length; i++ ) {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n let parent = wpPickerContainer.parentNode;\r\n parent.removeChild( wpPickerContainer );\r\n let newInput = document.createElement( 'input' );\r\n if( isId ) {\r\n newInput.setAttribute( 'id', attribute );\r\n } else {\r\n newInput.classList.add( 'wptb-element-property', attribute );\r\n }\r\n newInput.value = \"\";\r\n parent.appendChild( newInput );\r\n }\r\n }\r\n },\r\n detectMode: function() {\r\n var url = window.location.href,\r\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\r\n results = regex.exec(url);\r\n if (!results) return false;\r\n if (!results[2]) return '';\r\n return decodeURIComponent(results[2].replace(/\\+/g, ' '));\r\n },\r\n getColumnWidth: function( table, cell ) {\r\n let xIndex = cell.dataset.xIndex;\r\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\r\n let cellWidth = cell.getCellDimensions().width;\r\n for( let i = 0; i < xIndexes.length; i++ ) {\r\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\r\n cellWidth = xIndexes[i].getCellDimensions().width;\r\n }\r\n }\r\n return cellWidth;\r\n },\r\n getRowHeight: function( table, cell ) {\r\n let yIndex = cell.dataset.yIndex;\r\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\r\n let cellHeight = cell.getCellDimensions().height;\r\n for( let i = 0; i < yIndexes.length; i++ ) {\r\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\r\n cellHeight = yIndexes[i].getCellDimensions().height;\r\n }\r\n }\r\n return cellHeight;\r\n }\r\n}\r\n","var WPTB_Image = function ( src, DOMElementProt ) {\r\n let DOMElement,\r\n elImage,\r\n kindIndexProt = undefined,\r\n copy = false;\r\n if ( DOMElementProt == undefined ) {\r\n DOMElement = document.createElement( 'div' );\r\n elImage = document.createElement( 'div' );\r\n\t let anchor = document.createElement( 'a' ),\r\n\t img = document.createElement( 'img' );\r\n anchor.style.display = 'block';\r\n anchor.appendChild( img );\r\n DOMElement.classList.add( 'wptb-image-container' );\r\n elImage.classList.add( 'wptb-image-wrapper' );\r\n elImage.appendChild( anchor );\r\n DOMElement.appendChild( elImage );\r\n \r\n anchor.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n \r\n file_frame = wp.media.frames.file_frame = wp.media({\r\n\t\ttitle: 'Select a image to upload',\r\n\t\tbutton: {\r\n text: 'Use this image'\r\n\t\t},\r\n\t\tmultiple: false\r\n });\r\n // When an image is selected, run a callback.\r\n file_frame.on('select', function () {\r\n attachment = file_frame.state().get('selection').first().toJSON();\r\n let imgSrc = attachment.url;\r\n let linkArr = imgSrc.split( ':' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n img.src = linkClean;\r\n img.height = attachment.height;\r\n img.width = attachment.width;\r\n img.style.width = '100%';\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n });\r\n // Finally, open the modal\r\n if (src == undefined) {\r\n file_frame.open();\r\n } else {\r\n img.src = src;\r\n }\r\n } else {\r\n DOMElement = DOMElementProt.cloneNode( true );\r\n \r\n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\r\n e.preventDefault();\r\n };\r\n \r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n }\r\n \r\n this.kind = 'image';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n\treturn this;\r\n};","var WPTB_Initializer = function () {\r\n\r\n const MIN_COLUMNS = 1,\r\n MIN_ROWS = 1,\r\n MAX_COLUMNS = 10,\r\n MAX_ROWS = 10;\r\n\r\n var tableGenerator = document.body;\r\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\r\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\r\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\r\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\r\n columnsInput = document.getElementById('wptb-columns-number'),\r\n rowsInput = document.getElementById('wptb-rows-number');\r\n \r\n columnsDecrementButton.onclick = function () {\r\n if (columnsInput.value > MIN_COLUMNS) {\r\n columnsInput.value--;\r\n }\r\n };\r\n\r\n columnsIncrementButton.onclick = function () {\r\n if (columnsInput.value < MAX_COLUMNS) {\r\n columnsInput.value++;\r\n }\r\n };\r\n\r\n rowsDecrementButton.onclick = function () {\r\n if (rowsInput.value > MIN_ROWS) {\r\n rowsInput.value--;\r\n }\r\n };\r\n\r\n rowsIncrementButton.onclick = function () {\r\n if (rowsInput.value < MAX_ROWS) {\r\n rowsInput.value++;\r\n }\r\n };\r\n\r\n document.getElementById('wptb-generate-table').onclick = function () {\r\n var columns = document.getElementById('wptb-columns-number').value,\r\n rows = document.getElementById('wptb-rows-number').value;\r\n\r\n WPTB_Table(columns, rows);\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n};\r\n","var WPTB_innerElementSet = function ( element ) {\r\n \r\n function newElementProxy(el) {\r\n if (el == 'list') {\r\n return new WPTB_List();\r\n } else if (el == 'image') {\r\n return new WPTB_Image();\r\n } else if (el == 'text') {\r\n return new WPTB_Text();\r\n } else if (el == 'button') {\r\n return new WPTB_Button();\r\n }\r\n }\r\n \r\n element.ondragenter = function (e) {\r\n var div;\r\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\r\n return;\r\n }\r\n WPTB_DropHandle(this, e);\r\n \r\n element.classList.add( 'wptb-ondragenter' );\r\n }\r\n element.ondragover = function (e) {\r\n e.preventDefault();\r\n WPTB_DropHandle(this, e);\r\n }\r\n element.ondragleave = function () {\r\n \r\n }\r\n element.ondrop = function(e) {\r\n this.classList.remove( 'wptb-ondragenter' );\r\n let element, classId;\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\r\n return;\r\n }\r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n }\r\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n\r\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\r\n element = newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\r\n element = element.getDOMElement();\r\n } else {\r\n classId = e.dataTransfer.getData( 'node' );\r\n element = document.getElementsByClassName( classId )[0];\r\n //element.classList.remove( 'wptb-moving-mode' );\r\n }\r\n \r\n if( wptbDropHandle.style.display == 'block' ) {\r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n\r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n let thisRow = td.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n } else {\r\n return;\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n\r\n WPTB_innerElementSet( element );\r\n \r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\r\n element.classList.remove( 'wptb-moving-mode' );\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } \r\n return true;\r\n }\r\n element.onmouseover = function(e) {\r\n element.classList.remove( 'wptb-ondragenter' );\r\n }\r\n}","var WPTB_LeftPanel = function () {\r\n\r\n var table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n \r\n function wptbTdBgColorSavedSet( inputId, trNumber ) {\r\n if ( trNumber > 3 ) return;\r\n if( table ) {\r\n let tableRows = table.getElementsByTagName('tr');\r\n if ( tableRows.length > trNumber ) {\r\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\r\n var wptbEvenRowBg = document.getElementById(inputId);\r\n if ( wptbEvenRowBg && trBackgroundColor ) {\r\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\r\n }\r\n }\r\n }\r\n \r\n }\r\n \r\n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\r\n jQuery('#wptb-even-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n console.log(event);\r\n console.log(this);\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName('td');\r\n for ( let j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n },\r\n\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\r\n jQuery('#wptb-odd-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n \r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName( 'td' );\r\n for ( var j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n },\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\r\n jQuery('#wptb-table-header-bg').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = ui.color.toString();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n },\r\n clear: function(){\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = '';\r\n let tds = tableHeader.getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n \r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n });\r\n \r\n function tableAdaptiveForMobile( table ) {\r\n let wptbAdaptiveTableCheckbox = document.getElementById( 'wptb-adaptive-table-checkbox' );\r\n if( table && table.dataset.wptbAdaptiveTable && table.dataset.wptbAdaptiveTable == \"1\" ) {\r\n wptbAdaptiveTableCheckbox.checked = true;\r\n } else {\r\n wptbAdaptiveTableCheckbox.checked = false;\r\n }\r\n }\r\n tableAdaptiveForMobile( table );\r\n \r\n function tableTopRowAsHeadSavedSet( table ) {\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n wptbTopRowAsHeader.checked = true;\r\n } else {\r\n wptbTopRowAsHeader.checked = false;\r\n }\r\n }\r\n tableTopRowAsHeadSavedSet( table );\r\n \r\n function tableBorderColorWidthSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n if ( table.length > 0 ) {\r\n let tableBorderColor = table[0].style.borderColor;\r\n if ( tableBorderColor ) {\r\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\r\n if ( tableBorderColorInput ) {\r\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\r\n }\r\n }\r\n \r\n let tableBorderWidth = table[0].style.borderWidth;\r\n if ( tableBorderWidth ) {\r\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\r\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\r\n \r\n if ( wptbTableBorderWidthSlider ) {\r\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\r\n }\r\n if ( wptbTableBorderWidthNumber ) {\r\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\r\n }\r\n }\r\n \r\n \r\n let tableTd = table[0].querySelector( 'td' );\r\n let applyInnerBorder = tableTd.style.borderWidth;\r\n if ( applyInnerBorder ) {\r\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\r\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\r\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\r\n if ( innerBorderCheckInput ) {\r\n innerBorderCheckInput.checked = true;\r\n \r\n if ( wptbApplyInnerBorder ) {\r\n wptbApplyInnerBorder.classList.add( 'visible' );\r\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\r\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\r\n }\r\n }\r\n } else {\r\n innerBorderCheckInput.checked = false;\r\n }\r\n }\r\n \r\n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\r\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\r\n }\r\n }\r\n }\r\n \r\n tableBorderColorWidthSavedSet();\r\n\r\n jQuery('#wptb-table-border-color').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\r\n if ( document.getElementById('wptb-inner-border-check').checked ) {\r\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\r\n }\r\n }\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n clear: function() {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.borderColor = '';\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderColor = '';\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n\r\n function addInnerBorderSize(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\r\n tableCells[i].style.borderStyle = 'solid';\r\n }\r\n }\r\n\r\n function addCellPadding(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.padding = value + 'px';\r\n }\r\n }\r\n\r\n function addInnerBorder( checked ) {\r\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\r\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\r\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\r\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\r\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\r\n }\r\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\r\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if( wptbPreviewTable.length > 0 ) {\r\n if (checked == 'checked') {\r\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = width + ' solid ' + color;\r\n }\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\r\n } else {\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = '0px solid ' + color;\r\n tableCells[i].style.border = null;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n function addBorderSize( value ) {\r\n table.style.borderWidth = value + 'px';\r\n table.style.borderStyle = 'solid';\r\n }\r\n \r\n function cellPaddingSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n \r\n if ( table.length > 0 ) {\r\n let td = table[0].querySelector( 'td' );\r\n \r\n if ( td ) {\r\n let padding = td.style.padding;\r\n \r\n if ( padding ) {\r\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\r\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\r\n \r\n if ( wptbTableCellSlider ) {\r\n wptbTableCellSlider.value = parseInt( padding );\r\n }\r\n if ( wptbTableCellNumber ) {\r\n wptbTableCellNumber.value = parseInt( padding );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n cellPaddingSavedSet();\r\n \r\n function numberImputSize( wptbNumberInputs, maxCount, maxValue ) {\r\n wptbNumberInputs.onkeydown = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue[0] == 0 ) {\r\n this.value = \"\";\r\n } else {\r\n thisValue = thisValue.substring( 0, maxCount );\r\n this.value = thisValue;\r\n }\r\n }\r\n wptbNumberInputs.onkeyup = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue > maxValue ) {\r\n this.value = maxValue;\r\n }\r\n }\r\n }\r\n \r\n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\r\n numberImputSize( wptbTableBorderNumber, 1, 50 );\r\n \r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\r\n \r\n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\r\n numberImputSize( wptbTableCellNumber, 1, 50 );\r\n \r\n let wptbTextfontSizeNumber = document.getElementById( 'wptb-text-font-size-number' );\r\n numberImputSize( wptbTextfontSizeNumber, 1, 50 );\r\n \r\n let wptbImageWidthNumber = document.getElementById( 'wptb-image-width-number' );\r\n numberImputSize( wptbImageWidthNumber, 2, 100 );\r\n \r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n numberImputSize( wptbTableColumnWidthNumber, 2, 500 );\r\n \r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n numberImputSize( wptbTableRowHeightNumber, 2, 200 );\r\n \r\n \r\n \r\n document.getElementById('wptb-table-cell-slider').oninput = function () {\r\n document.getElementById('wptb-table-cell-number').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n \r\n document.getElementById('wptb-table-cell-slider').onchange = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n document.getElementById('wptb-table-cell-number').onchange = function () {\r\n document.getElementById('wptb-table-cell-slider').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById('wptb-table-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-border-number').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n \r\n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n };\r\n \r\n document.getElementById('wptb-table-border-slider').onchange = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n document.getElementById('wptb-table-border-number').onchange = function () {\r\n document.getElementById('wptb-table-border-slider').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-inner-border-number').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n \r\n document.getElementById('wptb-table-inner-border-slider').onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\r\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById('wptb-inner-border-check').onchange = function () {\r\n if( table ) {\r\n let val = this.checked ? 'checked' : 'unchecked';\r\n addInnerBorder( val );\r\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if( val == 'unchecked' && borderWidth == 0 ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-column-width-number' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-slider' ).onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n table.addColumnWidth( width );\r\n } else {\r\n table.addColumnWidth( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n document.getElementById( 'wptb-table-column-width-number' ).value = width;\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = width;\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-row-height-number' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-row-height-slider' ).onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-table-row-height-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n table.addRowHeight( height );\r\n } else {\r\n table.addRowHeight( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n document.getElementById( 'wptb-table-row-height-number' ).value = height;\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = height;\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-adaptive-table-checkbox' ).onchange = function() {\r\n if( this.checked ) {\r\n table.dataset.wptbAdaptiveTable = 1;\r\n } else {\r\n table.dataset.wptbAdaptiveTable = 0;\r\n }\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n function createMobileHeadForTable( table, thisEvent ) {\r\n \r\n if( thisEvent.checked ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n \r\n table.classList.add( 'wptb-table-preview-head' );\r\n table.rows[0].classList.add( 'wptb-table-head' );\r\n } else {\r\n let rows = table.rows;\r\n table.classList.remove( 'wptb-table-preview-head' );\r\n rows[0].classList.remove( 'wptb-table-head' );\r\n \r\n for ( let i = 1; i < rows.length; i++ ) {\r\n let thisRow = rows[i],\r\n thisRowChildren = thisRow.children;\r\n for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-font-size' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-background-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-align' );\r\n }\r\n }\r\n }\r\n }\r\n \r\n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\r\n createMobileHeadForTable( table, this );\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n }\r\n \r\n if( table ) {\r\n document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\r\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\r\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\r\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\r\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\r\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\r\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\r\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\r\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\r\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\r\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\r\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\r\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\r\n }\r\n \r\n document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n if( wptbContainer ) {\r\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\r\n wptbContainer.classList.remove( 'collapsed' );\r\n } else {\r\n wptbContainer.classList.add( 'collapsed' );\r\n }\r\n }\r\n };\r\n \r\n // this code hides the \"element parameters\" area \r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.onclick = function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n clickOnFreeSpace();\r\n } \r\n };\r\n \r\n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\r\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\r\n wptbHeader.onclick = function() {\r\n clickOnFreeSpace();\r\n }\r\n \r\n function clickOnFreeSpace() {\r\n document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\r\n document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\r\n document.getElementById( 'element-options-group' ).style.display = 'none';\r\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\r\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\r\n }\r\n }\r\n \r\n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\r\n\r\n var el_L = document.createElement('ul'), item,\r\n DOMElement = document.createElement('div'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n DOMElement.classList.add( 'wptb-list-item-container' );\r\n\r\n this.kind = 'list';\r\n\r\n if (innerElements === '') {\r\n //Case for edit mode list\r\n } else if ( !innerElements ) {\r\n for (var i = 0; i < 3; i++) {\r\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n } else {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n \r\n for ( var i = 0; i < innerElements.length; i++ ) {\r\n let listItem = DOMElementProt.querySelector( 'li' );\r\n item = new WPTB_ListItem( innerElements[i], listItem, true );\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n }\r\n DOMElement.appendChild(el_L);\r\n //window.addElementOptions('list', elList);\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n }\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n WPTB_Helper.listItemsRecalculateIndex( el_L );\r\n\r\n return this;\r\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\r\n let wptbListItemReturn;\r\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\r\n if (text == undefined) text = 'New List Item';\r\n var DOMElement = document.createElement('li'),\r\n //divdot = document.createElement('div'),\r\n divcontent = document.createElement('div');\r\n //libullet = document.createElement('li');\r\n //divdot.classList.add('wptb-list-item-style-dot');\r\n divcontent.classList.add('wptb-list-item-content');\r\n //libullet.classList.add('wptb-bullet');\r\n if ( DOMElementProt ) {\r\n let styleDot = DOMElementProt.getAttribute( 'style' );\r\n if ( styleDot ) {\r\n DOMElement.setAttribute( 'style', styleDot );\r\n }\r\n }\r\n //DOMElement.appendChild(divdot);\r\n DOMElement.appendChild(divcontent);\r\n //divdot.appendChild(libullet);\r\n divcontent.innerHTML = text;\r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = true;\r\n } else {\r\n var DOMElement = DOMElementProt;\r\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\r\n \r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = false;\r\n }\r\n \r\n DOMElement.onmouseenter = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 2, DOMElement );\r\n \r\n wptbActionsField.setParameters( DOMElement );\r\n console.log(DOMElement);\r\n };\r\n\r\n DOMElement.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.leaveFromField( event, DOMElement, 2 );\r\n \r\n return false;\r\n };\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n \r\n if ( wptbListItemReturn ) {\r\n return this;\r\n }\r\n};","var MultipleSelect = function () {\r\n\r\n\tvar selectedCells = [],\r\n\t\tmultipleCellMode = false;\r\n\r\n\tthis.activateMultipleSelectMode = function () {\r\n\t\tselectedCells = [];\r\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n\t\tfor (var i = 0; i < tds.length; i++) {\r\n\t\t\ttds[i].classList.remove('wptb-highlighted');\r\n\t\t}\r\n\t\tmultipleCellMode = true;\r\n\t}\r\n\r\n\tthis.deactivateMultipleSelectMode = function () {\r\n\t\tmultipleCellMode = false;\r\n\t}\r\n\r\n\tthis.isActivated = function () {\r\n\t\treturn multipleCellMode;\r\n\t}\r\n\r\n\tthis.pushSelectedCell = function (cell) {\r\n\t\tif (!multipleCellMode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tselectedCells.push(cell);\r\n\t\tcell.classList.add('wptb-highlighted');\r\n\t};\r\n\r\n\tthis.selectedCells = function () {\r\n\t\treturn selectedCells;\r\n\t}\r\n\r\n\tthis.flushSelectedCells = function () {\r\n\t\tselectedCells = [];\r\n\t}\r\n\r\n\tthis.getFirst = function () {\r\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tfirst = selectedCells[i];\r\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn first;\r\n\t}\r\n\r\n\tthis.getLast = function () {\r\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tlast = selectedCells[i];\r\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn last;\r\n\t}\r\n\r\n\tthis.removeAllButFirst = function () {\r\n\t\tvar td = this.getFirst();\r\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\r\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\r\n\t\t}\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_Parser = function (code) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","var WPTB_Parser2 = function (code) {\r\n if( Array.isArray( code ) ) {\r\n let elementHtml;\r\n \r\n if ( code.length == 1) {\r\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\r\n }\r\n if( 0 in code ) {\r\n let tagName = code[0];\r\n elementHtml = document.createElement( tagName );\r\n \r\n if ( 1 in code ) {\r\n if( Array.isArray( code[1] ) ) {\r\n let attributes = code[1];\r\n \r\n for( let i = 0; i < attributes.length; i++ ) {\r\n if( Array.isArray( attributes[i] ) ) {\r\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\r\n }\r\n }\r\n }\r\n }\r\n \r\n if ( 2 in code ) {\r\n if ( Array.isArray( code[2] ) ) {\r\n for ( let i = 0; i < code[2].length; i++ ) {\r\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\r\n continue;\r\n }\r\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\r\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\r\n }\r\n } else if( typeof code[2] === 'string' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2] ) );\r\n }\r\n \r\n }\r\n }\r\n \r\n return elementHtml;\r\n } else {\r\n return false;\r\n }\r\n \r\n}","var WPTB_Settings = function () {\r\n var elems = document.getElementsByClassName('wptb-element');\r\n\r\n for ( var i = 0; i < elems.length; i++ ) {\r\n elems[i].ondragstart = function ( event ) {\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\r\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\r\n }\r\n elems[i].ondragend = function () {\r\n let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\r\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\r\n if ( wptbDropHandle || wptbDropBorderMarker ) {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n }\r\n };\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n \r\n wptbUndo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if( wptbUndoRedoContainer.length > 0 ) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n \r\n wptbRedo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if( wptbUndoRedoContainer.length > 0 ) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\r\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\r\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\r\n }\r\n }\r\n \r\n window.onbeforeunload = function(e) {\r\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\r\n if( wptbSaveDisabled.length == 0 ) {\r\n return true;\r\n } else {\r\n return null;\r\n }\r\n };\r\n \r\n \r\n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( e ) {\r\n if( this.classList.contains( 'wptb-button-disable' ) ) {\r\n e.preventDefault();\r\n }\r\n }\r\n\r\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\r\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \r\n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\r\n return;\r\n }\r\n let bar = document.querySelector( '.wptb-edit-bar' );\r\n if ( bar && bar.classList.contains( 'visible' ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\r\n table.toggleTableEditMode();\r\n }\r\n\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\r\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\r\n messagingArea,\r\n code = document.getElementsByClassName( 'wptb-preview-table' );\r\n if( code.length > 0 ) {\r\n code = WPTB_Stringifier( code[0] );\r\n code = code.outerHTML;\r\n } else { \r\n code = '';\r\n }\r\n \r\n if ( t === '' || code === '' ) {\r\n let messagingAreaText = '';\r\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\r\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\r\n messagingArea.classList.add( 'wptb-warning' );\r\n setTimeout(function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n return;\r\n }\r\n\r\n let params = {\r\n title: t,\r\n content: code,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\r\n params.id = rs;\r\n }\r\n params = JSON.stringify( params );\r\n\r\n http.open('POST', url, true);\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function (action) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n\r\n if ( data[0] == 'saved' ) {\r\n document.wptbId = data[1];\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\r\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\r\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\r\n if( wptbPreviewBtn.length > 0 ) {\r\n wptbPreviewBtn = wptbPreviewBtn[0];\r\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\r\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\r\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\r\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\r\n }\r\n \r\n } else if( data[0] == 'edited' ) {\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\r\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n \r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n }\r\n } else {\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\r\n }\r\n messagingArea.classList.add( 'wptb-success' );\r\n setTimeout( function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n }\r\n }\r\n http.send( params );\r\n }\r\n};\r\n","var WPTB_Space = function ( elSpaceBetween ) {\r\n\r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n let spaceBetween;\r\n if ( ! elSpaceBetween ) {\r\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\r\n } else {\r\n spaceBetween = elSpaceBetween;\r\n }\r\n\r\n spaceBetween.ondragenter = function () {\r\n this.classList.add('visible');\r\n };\r\n spaceBetween.ondragover = function (event) {\r\n event.preventDefault();\r\n };\r\n\r\n spaceBetween.ondragleave = function () {\r\n this.classList.remove('visible');\r\n };\r\n\r\n spaceBetween.ondrop = function (event) {\r\n event.stopPropagation();\r\n\r\n var p = event.target.nextSibling,\r\n td = event.target,\r\n element, t_space, spaceParent;\r\n\r\n while ( !td.classList.contains('wptb-droppable') ) {\r\n td = td.parentNode;\r\n }\r\n\r\n if (event.dataTransfer.getData('wptbElement')) {\r\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\r\n this.classList.remove('visible');\r\n\r\n if (p == null) {\r\n td.appendChild(element.getDOMElement());\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element.getDOMElement(), p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n } else {\r\n alert(event.dataTransfer.getData('node'));\r\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\r\n t_space = element.nextSibling;\r\n spaceParent = element.parentNode;\r\n if (t_space != undefined) {\r\n spaceParent.removeChild(t_space);\r\n }\r\n\r\n if (p == null) {\r\n td.appendChild(element);\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element, p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n }\r\n this.classList.remove('visible');\r\n };\r\n \r\n if ( ! elSpaceBetween ) {\r\n return spaceBetween;\r\n }\r\n};","var WPTB_Stringifier = function ( codeMain ) {\r\n if ( codeMain ) {\r\n let code = codeMain.cloneNode( true );\r\n code.classList.add( 'wptb-table-preview-static-indic' );\r\n code.dataset.tableColumns = codeMain.columns;\r\n code.style.width = null;\r\n code.style.minWidth = null;\r\n code.style.maxWidth = null;\r\n \r\n let tds = code.getElementsByTagName( 'td' );\r\n if ( tds.length > 0 ) {\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n \r\n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\r\n tds[i].removeAttribute( 'data-x-index' );\r\n }\r\n tds[i].removeAttribute( 'data-y-index' );\r\n tds[i].removeAttribute( 'draggable' );\r\n tds[i].classList.remove( 'wptb-droppable' );\r\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( innerElements.length > 0 ) {\r\n for ( let j = 0; j < innerElements.length; j++ ) {\r\n \r\n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n \r\n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n \r\n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n \r\n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n \r\n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n \r\n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\r\n let wptbActionsLength = wptbActions.length;\r\n while ( wptbActionsLength > 0 ) {\r\n if( wptbActions[0] && wptbActions[0].parentNode ) {\r\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\r\n wptbActionsLength--;\r\n } else {\r\n break;\r\n }\r\n \r\n } \r\n }\r\n }\r\n \r\n if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\r\n let columnNameDivContainer = document.createElement( 'div' ),\r\n columnNameDiv = document.createElement( 'div' );\r\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\r\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\r\n columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\r\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\r\n color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\r\n columnNameDiv.style.padding = tds[i].style.padding;\r\n if( tds[i].children.length == 0 ) {\r\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\r\n }\r\n columnNameDivContainer.appendChild( columnNameDiv );\r\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\r\n }\r\n }\r\n }\r\n \r\n return code;\r\n }\r\n}","var WPTB_Stringifier2 = function ( node, start = false ) {\r\n\r\n\tif ( node == undefined ) {\r\n\t\treturn '';\r\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\r\n return node.nodeValue;\r\n }\r\n \r\n let code = [],\r\n children,\r\n int_elem_arr = false,\r\n attributes = [...node.attributes],\r\n attributes_list = [],\r\n internal_elements = [];\r\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \r\n node.parentNode.classList.contains( 'mce-content-body' ) ) && \r\n node.tagName.toLowerCase() == 'p' ) {\r\n children = node.childNodes;\r\n int_elem_arr = true;\r\n } else if( node.children.length > 0 ) {\r\n children = node.children;\r\n } else {\r\n children = node.childNodes;\r\n }\r\n if ( attributes.length > 0 ) {\r\n for ( let i = 0; i < attributes.length; i++ ) {\r\n attributes_list[i] = [attributes[i].name, attributes[i].value];\r\n }\r\n } else {\r\n attributes_list = '';\r\n }\r\n \r\n if ( children.length > 0 ) {\r\n for ( let i = 0; i < children.length; i++) {\r\n let inter_elem = WPTB_Stringifier(children[i]);\r\n \r\n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\r\n internal_elements[i] = inter_elem;\r\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\r\n internal_elements = inter_elem;\r\n }\r\n }\r\n } else {\r\n internal_elements = '';\r\n }\r\n \r\n \r\n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\r\n \r\n return code;\r\n}","var array = [], WPTB_Table = function (columns, rows) {\r\n\r\n /* The members of the class */\r\n var settings = document.getElementsByClassName('wptb-settings-items'),\r\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\r\n table, row, cell,\r\n maxAmountOfCells,\r\n maxAmountOfRows;\r\n\r\n //HERE ARE THE PRIVATE FUNCTIONS\r\n /*\r\n * This function toggles buttons visibility in cell edit mode\r\n * (according to the amount of currently selected cells), and\r\n * highlights visually the clicked cell if it is not highlighted, or\r\n * removes highlight if clicked cell is already highlighted. \r\n * It too toggles the bits of our abstract representation.\r\n * @param Event this is the event instance of the click performed over a cell.\r\n */\r\n var mark = function ( event ) {\r\n var rs = this.rowSpan,\r\n cs = this.colSpan,\r\n markedCells,\r\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n position = getCoords(this),\r\n row = position[0],\r\n column = position[1];\r\n if ( ! document.select.isActivated() ) {\r\n return;\r\n }\r\n if (this.className.match(/wptb-highlighted/)) {\r\n this.classList.remove('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 0;\r\n }\r\n }\r\n } else {\r\n this.classList.add('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 1;\r\n }\r\n }\r\n }\r\n\r\n markedCells = document.getElementsByClassName('wptb-highlighted').length;\r\n if (markedCells === 0) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n } else if (markedCells === 1) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.add('visible');\r\n singleCells[i].removeAttribute('disabled');\r\n }\r\n let cellHighlighted = document.querySelector( '.wptb-highlighted' );\r\n if( cellHighlighted ) {\r\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n let width = cellHighlighted.style.width;\r\n if( width ) {\r\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\r\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\r\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\r\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\r\n wptbTableColumnWidthSlider.value = cellWidth;\r\n wptbTableColumnWidthNumber.value = cellWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = false;\r\n }\r\n \r\n \r\n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n let height = cellHighlighted.style.height;\r\n if( height ) {\r\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\r\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\r\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\r\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\r\n wptbTableRowHeightSlider.value = cellHeight;\r\n wptbTableRowHeightNumber.value = cellHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = false;\r\n }\r\n }\r\n cellSettings.classList.add( 'visible' );\r\n } else {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n if (table.isSquare(array)) {\r\n multipleCells[i].classList.add('visible');\r\n multipleCells[i].removeAttribute('disabled');\r\n } else {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n }\r\n };\r\n\r\n /* \r\n * This function fills an array with 1's according to the actual design\r\n * of HTML table.\r\n * @returns an array of arrays containing an abstract representation\r\n * of HTML table.\r\n * @deprecated\r\n * */\r\n\r\n var realTimeArray = function () {\r\n var carried = [], tds, cols, matriz = [];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n cols = [];\r\n\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n\r\n for (items = 0; items < tds.length; items++) {\r\n\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n cols.push(1);\r\n }\r\n\r\n if (tds[items].rowSpan > 1) {\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n carried[items + k] = {\r\n justAssigned: true,\r\n amount: tds[items].rowSpan\r\n };\r\n }\r\n }\r\n }\r\n\r\n for (var k = 0; k < maxAmountOfCells; k++) {\r\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\r\n carried[k].amount--;\r\n if (carried[k].justAssigned) {\r\n carried[k].justAssigned = false;\r\n } else {\r\n cols.push(1);\r\n }\r\n }\r\n }\r\n\r\n matriz.push(cols);\r\n\r\n }\r\n return matriz;\r\n };\r\n\r\n /*\r\n * This function gets the number and position of cell spaces in current row that are occuped \r\n * by upper rowspanned cells.\r\n * @param number the number of row where we wish to calculate the carried rowspans up to.\r\n * @return an array with the remaining rowspans in each column.\r\n */\r\n var carriedRowspans = function (row) {\r\n var carried = [], tds, cols;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n if (row == -1) {\r\n return carried;\r\n }\r\n\r\n for (var i = 0; i <= row; i++) {\r\n cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (carried[xPosition]) {\r\n carried[xPosition]--;\r\n } else {\r\n celda = cellsBuffer[cellPointer++];\r\n if (celda.rowSpan > 1) {\r\n for (k = 0; k < celda.colSpan; k++) {\r\n carried[xPosition + k] = celda.rowSpan - 1;\r\n }\r\n stepsToMove = celda.colSpan;\r\n } else if (celda.colSpan > 1) {\r\n stepsToMove = celda.colSpan;\r\n }\r\n }\r\n }\r\n\r\n }\r\n return carried;\r\n };\r\n\r\n /*\r\n * A helpful function for showing\r\n * the abstract table in console.\r\n * @param Array our abstract table.\r\n */\r\n var drawTable = function (a) {\r\n var string = 'DRAWING TABLE:\\n';\r\n for (var i = 0; i < a.length; i++) {\r\n\r\n for (var j = 0; j < a[i].length; j++) {\r\n string += ' ' + a[i][j];\r\n }\r\n string += '\\n';\r\n }\r\n table.isSquare(a);\r\n };\r\n\r\n /*\r\n * It resets all the bits of our abstract representation\r\n * to 0 and removes the highlighting class of all cells.\r\n */\r\n\r\n var undoSelect = function () {\r\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n tds = table.getElementsByClassName('wptb-highlighted');\r\n while (tds.length) {\r\n tds[0].classList.remove('wptb-highlighted');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n for (var i = 0; i < array.length; i++) {\r\n for (var j = 0; j < array[i].length; j++) {\r\n array[i][j] = 0;\r\n }\r\n }\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n };\r\n\r\n /*\r\n * This fills the abstract representation of our table with \r\n * zeros, at the start. the max amount of cells is the greatest sum\r\n * of all colspans for row.\r\n */\r\n\r\n var fillTableArray = function () {\r\n var colspansSums = [], a = [];\r\n\r\n //calculate max amount of cells inside a row\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cells = table.rows[i].getElementsByTagName('td'),\r\n colspanSumInRow = 0;\r\n for (var j = 0; j < cells.length; j++) {\r\n colspanSumInRow += cells[j].colSpan;\r\n }\r\n colspansSums.push(colspanSumInRow);\r\n }\r\n\r\n maxAmountOfCells = Math.max.apply(null, colspansSums);\r\n //calculate max rows\r\n var maxAmountOfRows = table.rows.length;\r\n\r\n // fill with zeros from both values\r\n for (var i = 0; i < maxAmountOfRows; i++) {\r\n a[i] = [];\r\n for (var j = 0; j < maxAmountOfCells; j++) {\r\n a[i].push(0);\r\n }\r\n }\r\n drawTable(a);\r\n return a;\r\n };\r\n\r\n /*\r\n * This function gets the sum of all colspans in a row.\r\n * @param number the number of row to be used as reference.\r\n */\r\n var getActualPointsInRow = function (row) {\r\n var tds = table.rows[row].getElementsByTagName('td'),\r\n points = 0;\r\n for (var i = 0; i < tds.length; i++) {\r\n points += tds[i].colSpan;\r\n }\r\n return points;\r\n }\r\n\r\n /*\r\n * This function gets us the exact coordinates of\r\n * an exact cell, in a more reliable way than xIndex and yIndex,\r\n * these last ones were meant to be used for getting the cell trough them.\r\n * @param DOMElement the cell to get the coordinates.\r\n */\r\n var getCoords = function (search) {\r\n var skipInCols = [], cell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n skipInCols[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (skipInCols[xPosition]) {\r\n skipInCols[xPosition]--;\r\n } else {\r\n var td = cellsBuffer[cellPointer++];\r\n if (td == search) {\r\n return [i, xPosition];\r\n }\r\n if (td.rowSpan > 1) {\r\n for ( let k = 0; k < td.colSpan; k++ ) {\r\n skipInCols[xPosition + k] = td.rowSpan - 1;\r\n }\r\n stepsToMove = td.colSpan;\r\n } else if (td.colSpan > 1) {\r\n stepsToMove = td.colSpan;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n jQuery('#wptb-table-header-bg').val('');\r\n jQuery('#wptb-even-row-bg').val('');\r\n jQuery('#wptb-odd-row-bg').val('');\r\n jQuery('#wptb-table-border-color').val('');\r\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\r\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\r\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\r\n\r\n if (columns || rows) {\r\n //END OF PRIVATE FUNCTIONS\r\n for (var i = 0; i < settings.length; i++) {\r\n if (settings[i].id !== 'wptb-apply-inner-border') {\r\n settings[i].classList.add('visible');\r\n }\r\n }\r\n\r\n //Create a HTML Table element.\r\n table = document.createElement( 'table' );\r\n table.classList.add( 'wptb-preview-table' );\r\n table.dataset.reconstraction = 1;\r\n table.dataset.wptbAdaptiveTable = 1;\r\n //Add the data rows.\r\n for (var i = 0; i < rows; i++) {\r\n\r\n row = table.insertRow(-1);\r\n row.classList.add( 'wptb-row' );\r\n\r\n for (var j = 0; j < columns; j++) {\r\n cell = new WPTB_Cell(mark);\r\n cell.setCoords(i, j);\r\n row.appendChild(cell.getDOMElement());\r\n }\r\n }\r\n } else {\r\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n if (wptb_preview_table.length > 0) {\r\n table = wptb_preview_table[0];\r\n\r\n let cells = table.getElementsByTagName('td');\r\n\r\n if (cells.length > 0) {\r\n for (let i = 0; i < cells.length; i++) {\r\n WPTB_Cell(mark, cells[i]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * This just toggles visibility of cell edit bar, and toggles \r\n * cell selecting mode.\r\n */\r\n\r\n table.toggleTableEditMode = function () {\r\n let bar = document.getElementsByClassName('wptb-edit-bar'),\r\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\r\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\r\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if (wptbPreviewTable.length > 0) {\r\n wptbPreviewTable = wptbPreviewTable[0];\r\n }\r\n\r\n if ( bar.length > 0 ) {\r\n for ( let i = 0; i < bar.length; i++ ) {\r\n if ( bar[i].classList.contains( 'visible' ) ) {\r\n document.select.deactivateMultipleSelectMode();\r\n bar[i].classList.remove( 'visible' );\r\n cellModeBackground.classList.remove( 'visible' );\r\n leftScrollPanelCurtain.classList.remove( 'visible' );\r\n leftScrollPanelCellSettings.classList.remove( 'visible' );\r\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\r\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\r\n if ( wptbPreviewTableTds.length > 0 ) {\r\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\r\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n }\r\n } else {\r\n document.select.activateMultipleSelectMode();\r\n bar[i].classList.add( 'visible' );\r\n cellModeBackground.classList.add( 'visible' );\r\n leftScrollPanelCurtain.classList.add( 'visible' );\r\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table. \r\n */\r\n\r\n table.recalculateIndexes = function ( start ) {\r\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\r\n tdsArr = [];\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n for (var i = 0; i < trs.length; i++) {\r\n if ( i == 0 ) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\r\n }\r\n if( wptbTopRowAsHeader.checked ) {\r\n if( start == undefined ) {\r\n this.classList.add( 'wptb-table-preview-head' ); \r\n trs[i].classList.add( 'wptb-table-head' )\r\n } ;\r\n } else {\r\n if( start == undefined ) {\r\n this.classList.remove( 'wptb-table-preview-head' );\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n } else {\r\n if (i % 2 == 0) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n } else {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n\r\n tdsArr[i];\r\n tds = trs[i].getElementsByTagName('td');\r\n\r\n if (tdsArr[i] == undefined) {\r\n tdsArr[i] = [];\r\n }\r\n\r\n let jMainIter = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tdsArr[i][j] != undefined) {\r\n for (let y = 0; y < 100; y++) {\r\n if (tdsArr[i][jMainIter] != undefined) {\r\n jMainIter++;\r\n continue;\r\n }\r\n tdsArr[i][jMainIter] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n break;\r\n }\r\n } else {\r\n tdsArr[i][j] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n }\r\n tds[j].dataset.yIndex = i;\r\n\r\n if (tds[j].colSpan > 1) {\r\n for (let k = 1; k < tds[j].colSpan; k++) {\r\n jMainIter++;\r\n tdsArr[i][jMainIter] = 'tdDummy';\r\n }\r\n }\r\n\r\n if (tds[j].rowSpan > 1) {\r\n for (let x = 1; x < tds[j].rowSpan; x++) {\r\n if (tdsArr[i + x] == undefined) {\r\n tdsArr[i + x] = [];\r\n }\r\n for (let z = 0; z < tds[j].colSpan; z++) {\r\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\r\n }\r\n }\r\n }\r\n jMainIter++;\r\n if( i == 0 ) {\r\n maxColsFull = jMainIter;\r\n }\r\n }\r\n if (j > maxCols) {\r\n maxCols = j;\r\n }\r\n }\r\n this.columns = maxCols;\r\n this.maxCols = maxColsFull;\r\n }\r\n \r\n table.addColumnWidth = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataXIndex = highlighted[k].dataset.xIndex;\r\n if( dataXIndex ) {\r\n function tableTdsFor( dataXIndex, colspan ) {\r\n let tableRows = table.rows;\r\n let widthIsSet = false;\r\n let arrayTdsFromPreviousRow = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.xIndex == dataXIndex ) {\r\n if( value ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n widthIsSet = true;\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n }\r\n } else {\r\n td.style.width = null;\r\n td.dataset.wptbFixedWidth = value;\r\n if( i == tableRows.length - 1 && ! widthIsSet ) {\r\n tableTdsFor( dataXIndex, colspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.width = null;\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } else {\r\n if( td.dataset.wptbFixedWidth ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = td.dataset.wptbFixedWidth + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } \r\n } else if( td.style.width ) {\r\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\r\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\r\n }\r\n arrayTdsFromPreviousRow = [];\r\n } else {\r\n arrayTdsFromPreviousRow.push( td );\r\n }\r\n }\r\n break;\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataXIndex, 1 );\r\n }\r\n }\r\n \r\n table.tdDefaultWidth();\r\n }\r\n }\r\n \r\n table.tdDefaultWidth = function() {\r\n let rows = table.rows;\r\n \r\n let tableTdsSumMaxWidth = 0;\r\n let tableTdsSumMaxWidthFixed = 0;\r\n let tableTdsSumMaxWidthAuto = 0;\r\n \r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n \r\n let arrayCellsWidthFixedHelper = [];\r\n let arrayCellsWidthAutoHelper = [];\r\n let tdPaddingCommon = 0;\r\n let tableTdBorderCommonWidth = 0;\r\n let cssForTdsWidthAuto = '';\r\n \r\n for( let i = 0; i < rows.length; i++ ) {\r\n let tds = rows[i].children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n \r\n if( ! arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( td.style.width ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] = parseFloat( td.style.width );\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n } else {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] = 100;\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n }\r\n \r\n if( window.getComputedStyle( td, null ) ) {\r\n let tdStyleObj = window.getComputedStyle( td, null );\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\r\n\r\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\r\n if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n } else {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n }\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n } else if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n }\r\n }\r\n }\r\n \r\n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\r\n if( arrayCellsWidthFixedHelper[i] ) {\r\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\r\n }\r\n }\r\n \r\n let CellsWidthAutoCount = 0;\r\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\r\n if( arrayCellsWidthAutoHelper[i] ) {\r\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\r\n CellsWidthAutoCount++;\r\n }\r\n }\r\n \r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\r\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\r\n \r\n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\r\n if( CellsWidthAutoCount ) {\r\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\r\n if( table.mergingСellsHorizontally ) {\r\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n }\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\r\n }\r\n \r\n let styleElementCreate = false;\r\n let tableTdWidthAuto;\r\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\r\n if( CellsWidthAutoCount ) {\r\n table.style.minWidth = '100%';\r\n if( table.mergingСellsHorizontally ) {\r\n table.style.width = null;\r\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\r\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\r\n styleElementCreate = true;\r\n } else {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.width = null;\r\n table.style.minWidth = null;\r\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\r\n }\r\n } else {\r\n table.style.maxWidth = null;\r\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\r\n table.style.width = null;\r\n tableTdWidthAuto = '100'\r\n styleElementCreate = true;\r\n }\r\n \r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAutoOld ) {\r\n head.removeChild( cssForTdsWidthAutoOld );\r\n }\r\n }\r\n \r\n if( styleElementCreate ) {\r\n cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\r\n if( head ) {\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n }\r\n \r\n table.addRowHeight = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataYIndex = highlighted[k].dataset.yIndex;\r\n if( dataYIndex ) {\r\n function tableTdsFor( dataYIndex, rowspan ) {\r\n let tableRows = table.rows;\r\n let heightIsSet = false;\r\n let arrayTdsPrevious = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.yIndex == dataYIndex ) {\r\n if( value ) {\r\n if( td.rowSpan == rowspan ) {\r\n td.style.height = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n heightIsSet = true;\r\n let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\r\n tableColumnHeightAutoFixedCheckbox.checked = true;\r\n }\r\n continue;\r\n } else {\r\n td.style.height = null;\r\n td.dataset.wptbFixedHeight = value;\r\n if( j == tds.length - 1 && ! heightIsSet ) {\r\n tableTdsFor( dataYIndex , rowspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.height = null;\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n } else {\r\n if( td.dataset.wptbFixedHeight ) {\r\n if( td.rowSpan = rowspan ) {\r\n td.style.height = td.dataset.wptbFixedHeight + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n }\r\n } else if( td.style.height ) {\r\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\r\n arrayTdsPrevious[z].style.height = td.style.height;\r\n }\r\n arrayTdsPrevious = [];\r\n } else {\r\n arrayTdsPrevious.push( td );\r\n }\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataYIndex, 1 );\r\n }\r\n }\r\n }\r\n }\r\n \r\n table.reconstraction = function() {\r\n let tds = table.getElementsByTagName( 'td' );\r\n let wptbAdaptiveTableChoseBlock = document.getElementsByClassName( 'wptb-adaptive-table-chose-block' );\r\n if( wptbAdaptiveTableChoseBlock.length > 0 ) {\r\n wptbAdaptiveTableChoseBlock = wptbAdaptiveTableChoseBlock[0];\r\n }\r\n table.mergingСellsHorizontally = false;\r\n table.mergingCellsVertically = false;\r\n table.dataset.reconstraction = 1;\r\n wptbAdaptiveTableChoseBlock.style.display = 'block';\r\n let forBreak = 0;\r\n for( let i = 0; i < tds.length; i++ ) {\r\n if( tds[i].colSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingСellsHorizontally = true;\r\n forBreak++;\r\n }\r\n \r\n if( tds[i].rowSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingCellsVertically = true;\r\n forBreak++;\r\n }\r\n \r\n if( forBreak == 2 ) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * As simple as it is: adds a column to the end of table.\r\n */\r\n table.addColumnEnd = function () {\r\n let td,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n \r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n \r\n table.rows[i].appendChild(td.getDOMElement());\r\n array[i].push(0);\r\n }\r\n \r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * As simple as it looks: adds a column to the start of table.\r\n */\r\n\r\n table.addColumnStart = function () {\r\n let td,\r\n firstCell,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if ( currentTable.length > 0 ) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if ( currentTableTd ) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n firstCell = table.rows[i].getElementsByTagName('td')[0];\r\n if (firstCell) {\r\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\r\n } else {\r\n table.rows[i].appendChild(td.getDOMElement());\r\n }\r\n array[i].push(0);\r\n }\r\n\r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Well, not so simple as previous functions.\r\n * It adds a column after a certain column of reference.\r\n * @param integer the column number to be used as reference.\r\n *\tIf empty, then the first highlighted cell is used as reference.\r\n */\r\n\r\n table.addColumnAfter = function (c_pos) {\r\n let rows = table.rows,\r\n cellPointer,\r\n cellsBuffer,\r\n cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\r\n \r\n \r\n \r\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\r\n table.addColumnEnd();\r\n } else {\r\n let pendingInsertion = false,\r\n stepsToMove,\r\n td, bro,\r\n carriedRowspans = [],\r\n currentCell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carriedRowspans.push(0);\r\n }\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n cellPointer = 0;\r\n cellsBuffer = rows[i].getElementsByTagName('td');\r\n pendingInsertion = false;\r\n for (var xPosition = 0;\r\n xPosition < maxAmountOfCells;\r\n xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (pendingInsertion) {\r\n td = new WPTB_Cell(mark);\r\n if (cellStyle) {\r\n td.getDOMElement().setAttribute('style', cellStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n if (currentCell && rows[i].contains(currentCell)) {\r\n bro = currentCell.nextSibling;\r\n if (bro) {\r\n rows[i].insertBefore(td.getDOMElement(), bro);\r\n } else {\r\n rows[i].appendChild(td.getDOMElement());\r\n }\r\n } else {\r\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\r\n }\r\n break;\r\n } else if (carriedRowspans[xPosition] > 0) {\r\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\r\n if (pos == xPosition) {\r\n pendingInsertion = true;\r\n }\r\n } else {\r\n currentCell = cellsBuffer[cellPointer++];\r\n if (currentCell.rowSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (currentCell.colSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (xPosition == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n }\r\n\r\n for (var l = 0; l < maxAmountOfCells; l++) {\r\n if (carriedRowspans[l] > 0)\r\n carriedRowspans[l]--;\r\n }\r\n\r\n }\r\n\r\n for (var i = 0; i < array.length; i++) {\r\n array[i].push(0);\r\n }\r\n maxAmountOfCells++;\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /*\r\n * For preventing us to take a lot of time,\r\n * This is just calling the function addColumnAfter, but\r\n * using the previous column to current one as reference.\r\n * @see addColumnAfter\r\n */\r\n\r\n table.addColumnBefore = function () {\r\n var cell = document.querySelector('.wptb-highlighted'),\r\n pos = getCoords(cell)[1];\r\n\r\n if (pos === 0) {\r\n table.addColumnStart();\r\n } else {\r\n table.addColumnAfter(pos - 1);\r\n }\r\n };\r\n\r\n /*\r\n * Luckily, thisfunction is simple, \r\n * it just add a row to the end of table.\r\n */\r\n\r\n table.addRowToTheEnd = function () {\r\n let r = table.insertRow(-1),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Yet another simple function, \r\n * it just add a row to the start of table.\r\n */\r\n\r\n table.addRowToTheStart = function () {\r\n let r = table.insertRow(0),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /* \r\n * This function adds a row before the current one.\r\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\r\n * the most of the troubles is not here.\r\n */\r\n\r\n table.addRowBefore = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellNew;\r\n for( let i = row - 1; i >= 0; i-- ) {\r\n let rowChildren = table.rows[i].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for( let j = 0; j < rowChildrenLength; j++ ) {\r\n if( rowChildren[j].rowSpan == 1 ) {\r\n row = i;\r\n cellNew = true;\r\n break;\r\n }\r\n }\r\n }\r\n if ( cellNew ) {\r\n break;\r\n }\r\n }\r\n\r\n if (row === 0) {\r\n table.addRowToTheStart();\r\n } else {\r\n table.addRowAfter( row, cellStyle );\r\n }\r\n };\r\n\r\n /*\r\n * Well... by the name convention of the previous 3 functions,\r\n * it's pretty obvious that this functions attaches a new\r\n * row after highlighted cell row. The greatest obstacle it was\r\n * the possibility of a TR not having the exact amount of columns\r\n * occuped by actual node but rowspanned upper cells. For that purpose\r\n * it was created the function realTimeArray.\r\n * @see realTimeArray\r\n */\r\n\r\n table.addRowAfter = function ( row, cellStyle ) {\r\n let cellRowSpan,\r\n rowAfter,\r\n aux;\r\n \r\n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\r\n let cell = document.querySelector('.wptb-highlighted');\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellRowSpan = cell.rowSpan,\r\n rowAfter = row + cellRowSpan - 1;\r\n } else {\r\n rowAfter = row;\r\n }\r\n \r\n \r\n let cellsColSpan = 0;\r\n if ( rowAfter < table.rows.length -1 ) {\r\n for( let i = 0; i <= rowAfter ; i++ ) {\r\n let tableRowsIChildren = table.rows[i].children,\r\n tableRIChildrenLength = tableRowsIChildren.length;\r\n if( tableRIChildrenLength > 0 ) {\r\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\r\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\r\n\r\n if ( rowIRowSpan - 1 + i > rowAfter ) {\r\n tableRowsIChildren[j].rowSpan++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let rNext = table.rows[rowAfter + 1],\r\n rNextChildren = rNext.children,\r\n rNextChildrenLength = rNextChildren.length;\r\n \r\n if( rNextChildrenLength > 0 ) {\r\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\r\n cellsColSpan += rNextChildren[i].colSpan;\r\n }\r\n }\r\n } else {\r\n cellsColSpan = array[0].length;\r\n }\r\n \r\n let r = table.insertRow( rowAfter + 1 );\r\n r.classList.add( 'wptb-row' );\r\n \r\n for ( j = 0; j < cellsColSpan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyle );\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n r.appendChild( td.getDOMElement() );\r\n }\r\n\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This function checks the current selected cells\r\n * make a rectangular shape.\r\n * @param Array the abstract table.\r\n * @return false, if not making a rectangle, or\r\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\r\n */\r\n\r\n table.isSquare = function (a) {\r\n var rowStart = -1,\r\n columnStart = -1,\r\n rowEnd = -1,\r\n columnEnd = -1,\r\n height,\r\n width,\r\n itemsEstimate = 0,\r\n items = 0;\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n if ( j < columnStart || columnStart == -1 ) {\r\n columnStart = j;\r\n }\r\n if ( i < rowStart || rowStart == -1 ) {\r\n rowStart = i;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n for (var i = a.length - 1; i > -1; i--) {\r\n for (var j = a[i].length - 1; j > -1; j--) {\r\n if (a[i][j] == 1) {\r\n if ( j > columnEnd ) {\r\n columnEnd = j;\r\n }\r\n if ( i > rowEnd ) {\r\n rowEnd = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = rowStart; i < rowEnd; i++) {\r\n for (var j = columnStart; j < columnEnd; j++) {\r\n if (a[i][j] == 0 || a[i][j] == undefined) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n items++;\r\n }\r\n }\r\n }\r\n\r\n height = rowEnd - rowStart + 1;\r\n width = columnEnd - columnStart + 1;\r\n itemsEstimate = height * width;\r\n\r\n if (itemsEstimate !== items) {\r\n return false;\r\n }\r\n return [height, width];\r\n };\r\n\r\n /*\r\n * This function merges all selected cells.\r\n * Well, actually sets the colspan and rowspan of first \r\n * upper left cell in selection and deletes the another selected cells.\r\n */\r\n\r\n table.mergeCells = function () {\r\n var dimensions = table.isSquare(array),\r\n rowspan = dimensions[0],\r\n colspan = dimensions[1],\r\n first = document.querySelector('.wptb-highlighted'),\r\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\r\n tdsChildrenNew = [];\r\n\r\n for (let i = 0; i < tds.length; i++) {\r\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\r\n if (tdsInternalElements.length > 0) {\r\n let tdsIntElemLength = tdsInternalElements.length;\r\n for (let j = 0; j < tdsIntElemLength; j++) {\r\n tdsChildrenNew.push(tdsInternalElements[j]);\r\n }\r\n }\r\n let p = tds[i].parentNode;\r\n p.removeChild(tds[i]);\r\n }\r\n if (tdsChildrenNew.length > 0) {\r\n for (let i = 0; i < tdsChildrenNew.length; i++) {\r\n first.appendChild(tdsChildrenNew[i]);\r\n }\r\n }\r\n\r\n first.colSpan = colspan;\r\n first.rowSpan = rowspan;\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n let firstWidth = first.style.width;\r\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\r\n if( firstWidth ) {\r\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\r\n } else if( firstDataFixedWidth ) {\r\n table.addColumnWidth();\r\n } else {\r\n table.addColumnWidth( false, true );\r\n }\r\n \r\n let firstHeight = first.style.height;\r\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\r\n if( firstHeight ) {\r\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\r\n } else if( firstDataFixedHeight ) {\r\n table.addRowHeight();\r\n } else {\r\n table.addRowHeight( false, true );\r\n }\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This functions makes the exact inverse as above.\r\n * It resets colspan and rowspan and appends \r\n * the same amount in cells to the table.\r\n * @bug\r\n */\r\n\r\n table.splitCell = function () {\r\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\r\n rowspan = cell.rowSpan,\r\n colspan = cell.colSpan,\r\n cellStyles = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n thisRow = table.rows[row],\r\n cellXIndex =cell.dataset.xIndex;\r\n \r\n cell.rowSpan = 1;\r\n cell.colSpan = 1;\r\n \r\n for (let i = 1; i < colspan; i++) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().classList.add( 'wptb-highlighted' );\r\n if ( cell.nextSibling ) {\r\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\r\n } else {\r\n thisRow.appendChild( td.getDOMElement() );\r\n }\r\n \r\n }\r\n\r\n if (rowspan > 1) {\r\n for (let i = 1; i < rowspan; i++) {\r\n let rowChildInsertBefore = undefined,\r\n rowNext = table.rows[row + i],\r\n rowChildren = rowNext.children,\r\n rowChildrenLength = rowChildren.length;\r\n \r\n if ( rowChildrenLength > 0 ) {\r\n for ( let k = 0; k < rowChildrenLength; k++ ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\r\n rowChildInsertBefore = rowChildren[k];\r\n break;\r\n } \r\n }\r\n }\r\n for ( let j = 0; j < colspan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyles );\r\n if ( rowChildInsertBefore != undefined ) {\r\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\r\n } else {\r\n rowNext.appendChild( td.getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Searches for rowspanned cells up to row number meeting it.\r\n * @param number the number of row where the function\r\n * must search up to.\r\n */\r\n\r\n table.findRowspannedCells = function (row) {\r\n var array = [],\r\n difference;\r\n actualPoints = getActualPointsInRow(row);\r\n if (actualPoints === maxAmountOfCells) {\r\n return [];\r\n }\r\n difference = maxAmountOfCells - actualPoints;\r\n\r\n for (var i = row - 1; i >= 0 && difference; i--) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n if (tds[i].rowSpan > 1) {\r\n array.push(tds[i]);\r\n difference -= tds[i].colSpan;\r\n }\r\n }\r\n }\r\n return array;\r\n\r\n }\r\n\r\n /*\r\n * This function explores the table and adds \r\n * a cell for each lacking one for each row\r\n * to meet an even amount of cells.\r\n */\r\n\r\n table.addLackingCells = function () {\r\n var sumRows = [];\r\n for (var i = 0; i < table.rows.length; i++) {\r\n sumRows.push(0);\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tds[j].rowSpan > 1) {\r\n for (var k = 1; k < tds[j].rowSpan; k++) {\r\n sumRows[i + k]++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td'),\r\n totalColspan = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n totalColspan += tds[j].colSpan;\r\n }\r\n totalColspan += sumRows[i];\r\n difference = maxAmountOfCells - totalColspan;\r\n for (var j = 0; j < difference; j++) {\r\n var td = new WPTB_Cell(mark);\r\n table.rows[i].appendChild(td.getDOMElement());\r\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * This function deletes the row of currently\r\n * selected cell. \r\n */\r\n\r\n table.deleteRow = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyles = cell.getAttribute('style'),\r\n rowspan = cell.rowSpan,\r\n row = getCoords(cell)[0],\r\n thisRow,\r\n aux;\r\n \r\n if ( rowspan == undefined ) rowspan = 1;\r\n \r\n for ( let i = 0; i < rowspan; i++ ) {\r\n thisRow = table.rows[row];\r\n let thisRowChildren = thisRow.children,\r\n nextRow = table.rows[row + 1],\r\n nextRowChildren,\r\n nextRowChildrenLength,\r\n tdArr = [];\r\n\r\n if( nextRow != undefined ) {\r\n nextRowChildren = nextRow.children;\r\n nextRowChildrenLength = nextRowChildren.length;\r\n for (let j = 0; j < thisRowChildren.length; j++) {\r\n if ( thisRowChildren[j].rowSpan > 1 ) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\r\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\r\n\r\n let nextRowChildrenK = undefined;\r\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\r\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\r\n nextRowChildrenK = nextRowChildren[k];\r\n break;\r\n } \r\n }\r\n\r\n if ( nextRowChildrenK ) {\r\n tdArr.push( [td, nextRowChildrenK] );\r\n } else {\r\n tdArr.push( [td] );\r\n }\r\n }\r\n }\r\n\r\n if ( tdArr.length > 0 ) {\r\n for ( let k = 0; k < tdArr.length; k++ ) {\r\n if ( tdArr[k][1] != undefined ) {\r\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\r\n } else {\r\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n \r\n let tableRows = table.rows;\r\n if ( tableRows.length > 0 ) {\r\n for ( let j = 0; j < row; j++ ) {\r\n let jRowChildren = tableRows[j].children;\r\n if ( jRowChildren.length > 0 ) {\r\n for ( let x = 0; x < jRowChildren.length; x++ ) {\r\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\r\n jRowChildren[x].rowSpan--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n aux = Array.from(array[0]);\r\n array.pop(aux);\r\n drawTable(array);\r\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\r\n \r\n if( table.rows.length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n /*\r\n * This function deletes the column of currently\r\n * selected cell. Again, this is way more complicated than\r\n * delete row case.\r\n */\r\n\r\n table.deleteColumn = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellXIndex = cell.dataset.xIndex,\r\n colspan = cell.colSpan;\r\n \r\n for ( let i = 0; i < colspan; i++ ) {\r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n let rowChildren = table.rows[j].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n } else {\r\n table.rows[j].removeChild( rowChildren[k] );\r\n }\r\n break;\r\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \r\n Number( rowChildren[k].dataset.xIndex ) + \r\n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n \r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n if (array[j] != undefined)\r\n array[j].pop();\r\n }\r\n \r\n maxAmountOfCells--;\r\n \r\n if( table.querySelectorAll( 'td' ).length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n\r\n array = fillTableArray();\r\n\r\n undoSelect();\r\n drawTable(array);\r\n\r\n wptbTableSetup.appendChild(table);\r\n //if (columns || rows) {\r\n table.recalculateIndexes( true );\r\n //}\r\n table.reconstraction();\r\n table.tdDefaultWidth();\r\n \r\n wptbTableSetup.onresize = function() {\r\n table.tdDefaultWidth();\r\n };\r\n\r\n WPTB_LeftPanel();\r\n \r\n // this code gets the ID of the active element in the toolbar \r\n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\r\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\r\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\r\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\r\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\r\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\r\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\r\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\r\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\r\n// }\r\n// }\r\n// }, false );\r\n// }\r\n \r\n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\r\n// if( wptbPanelLeft.length > 0 ) {\r\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }, false );\r\n// }\r\n \r\n// let body = document.getElementsByTagName( 'body' );\r\n// if( body.length > 0 ) {\r\n// body[0].addEventListener( 'click', function( e ) {\r\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }\r\n// }, false );\r\n// }\r\n};","var WPTB_TableStateSaveManager = function() {\n this.tableStateSet = () => {\n // get preview table\n let wptbPreviewTable = document.getElementsByClassName( 'wptb-preview-table' );\n if( wptbPreviewTable.length > 0 ) {\n wptbPreviewTable = wptbPreviewTable[0];\n \n // check if a global array doesn't exist with saved versions of the table \n // them create it\n if( ! window.wptbTableStateSaving ) {\n window.wptbTableStateSaving = [];\n } \n \n // remove the extra part of the array after changing the table \n // when it is showed in the not last modified version\n if( window.wptbTableStateSaving.length > window.wptbTableStateNumberShow + 1 ) {\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\n }\n \n //add new state of table\n let wptbNewPreviewTable = wptbPreviewTable.cloneNode( true );\n let wptbHighlighted = wptbNewPreviewTable.getElementsByClassName( 'wptb-highlighted' );\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\n }\n let wptbDirectlyhovered = wptbNewPreviewTable.getElementsByClassName( 'wptb-directlyhovered' );\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\n }\n \n let cssForTdsWidthAutoValue = '';\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAuto = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAuto ) {\n cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\n }\n }\n \n let mceContentBodys = wptbNewPreviewTable.querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n\n let dataMceStyle = wptbNewPreviewTable.querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n\n let mceIds = wptbNewPreviewTable.querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n \n window.wptbTableStateSaving.push( [wptbNewPreviewTable, cssForTdsWidthAutoValue] );\n \n // set new number of state which is showed now\n window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\n \n // make undo arrow active when the table was changed\n if( window.wptbTableStateSaving.length > 1 ) {\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\n }\n }\n \n // make redo arrow not active when the table was changed\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n }\n }\n \n this.tableStateGet = ( datawptbUndoredo ) => {\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 1 ) {\n \n // changes the number of the state which displays now\n if( datawptbUndoredo == 'undo' ) {\n if( window.wptbTableStateNumberShow > 0 ) {\n window.wptbTableStateNumberShow--;\n } else {\n return false;\n }\n } else if( datawptbUndoredo == 'redo' ) {\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n window.wptbTableStateNumberShow++;\n } else {\n return false;\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for undo button\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n }\n if( window.wptbTableStateNumberShow == 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow > 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for redo button\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n }\n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n \n // load necessary saved table state\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n wptbTableSetup.innerHTML = '';\n wptbTableSetup.appendChild( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] );\n\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\n let cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n WPTB_Helper.settingsPanelClear();\n WPTB_Helper.elementOptionsPanelClear();\n WPTB_LeftPanel();\n\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \n if( wptbLeftScrollPanelCellSetting ) {\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\n }\n }\n }\n }\n}","var WPTB_Text = function ( text , DOMElementProt ) {\r\n let DOMElement = document.createElement('div'),\r\n elText2 = document.createElement('div'),\r\n elP = document.createElement('p'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n \r\n DOMElement.classList.add( 'wptb-text-container' );\r\n\r\n elP.innerHTML = text != undefined ? text : 'Text';\r\n elText2.appendChild(elP);\r\n DOMElement.appendChild(elText2);\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n\r\n let attributes = [...DOMElementProt.attributes];\r\n for( let i = 0; i < attributes.length; i++ ) {\r\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\r\n }\r\n } \r\n\r\n this.kind = 'text';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n return this;\r\n};"]}
|
1 |
+
{"version":3,"sources":["applyGenericItemSettings.js","wptb-builder.js","WPTB_ActionsField.js","WPTB_Builder.js","WPTB_Button.js","WPTB_Cell.js","WPTB_DropHandle.js","WPTB_ElementCounters.js","WPTB_ElementOptions.js","WPTB_Helper.js","WPTB_Image.js","WPTB_Initializer.js","WPTB_innerElementSet.js","WPTB_LeftPanel.js","WPTB_List.js","WPTB_ListItem.js","WPTB_MultipleSelect.js","WPTB_Parser.js","WPTB_Parser2.js","WPTB_Settings.js","WPTB_Space.js","WPTB_Stringifier.js","WPTB_Stringifier2.js","WPTB_Table.js","WPTB_TableStateSaveManager.js","WPTB_Text.js"],"names":["applyGenericItemSettings","element","kindIndexProt","copy","node","getDOMElement","index","listItems","undefined","document","counter","nextIndex","kind","wptbElements","getElementsByClassName","elementIndexesArr","i","length","regex","RegExp","infArr","className","match","push","elementIndexMax","Math","max","split","onmouseenter","event","target","classList","contains","wptbActionsField","WPTB_ActionsField","addActionField","setParameters","remove","a","querySelector","onclick","e","preventDefault","WPTB_Helper","buttonsTinyMceInit","tinyMCE","init","childNodes","inline","plugins","dialog_type","theme","menubar","fixed_toolbar_container","paste_as_text","toolbar","setup","ed","on","row","findAncestor","table","dataTitleColumnSet","onblur","wptbTableStateSaveManager","WPTB_TableStateSaveManager","tableStateSet","init_instance_callback","editor","window","currentEditor","totalWidth","offsetWidth","getElementById","scrollTop","bodyElement","style","display","position","right","top","listItemsTinyMceInit","onmouseleave","wptbActions","type","leaveFromField","observer","MutationObserver","mutations","config","attributes","attributeFilter","observe","node_wptb_element_kind_num","add","WPTB_ElementOptions","increment","actionType","thisNode","body","getElementsByTagName","actions","previousNode","activeElem","parentNode","removeChild","btnDelete","btnCopy","btnMove","createElement","draggable","appendChild","act","el","thisRow","actionsRemove","activeElement","activeElementClone","cloneNode","td","temp","srcList","querySelectorAll","innerHTML","WPTB_List","insertBefore","nextSibling","WPTB_Text","WPTB_Image","text","WPTB_Button","WPTB_innerElementSet","ondragstart","dragImagesArr","dataTransfer","effectAllowed","setDragImage","setData","actionsHide","previous","append","wptbDirectlyhovered","action","item","parent","listItemsRecalculateIndex","coordinatesElement","getBoundingClientRect","coordinatesElementTopBegin","listItem","content","html","duplicate","WPTB_ListItem","firstChild","divcontent","setTimeout","coordinatesElementTopEnd","wptbContainer","correctTop","parseFloat","removeEventListener","left","clientWidth","addEventListener","relatedTarget","localName","opacity","WPTB_Builder","table_id","detectMode","http","XMLHttpRequest","urlSet","ajaxurl","open","setRequestHeader","onreadystatechange","d","readyState","status","ans","JSON","parse","responseText","value","wptbTableSetupEl","WPTB_Parser","WPTB_Table","WPTB_LeftPanel","WPTB_Settings","send","ElementCounters","select","MultipleSelect","initializer","WPTB_Initializer","settings","DOMElementProt","DOMElement","elButton","el_B","el_BDiv","el_BDivP","wptbElementMutch","Array","isArray","attributesContainer","setAttribute","name","wptbButtonWrapper","wptbButtonWrapAttributes","wptbButtonA","wptbButtonAttributes","wptbButton","WPTB_Cell","callback","highlightRow","parentRow","columnCount","parseInt","tds","classToAdd","ttd","highlightColumn","rowCount","tr","padding","jQuery","val","innerBorderWidth","border","wptbPhElement","wptbSpaceBetween","j","WPTB_Space","wptbElementTypeClass","wptbTypeElementArr","wptbListItems","setCoords","y","x","dataset","yIndex","xIndex","getCoords","coords","appendElement","getCellDimensions","tdStyleObj","getComputedStyle","tdPaddingLeft","getPropertyValue","tdPaddingRight","tdBorderLeftWidth","tdBorderRightWidth","tdPaddingTop","tdPaddingBottom","tdBorderTopWidth","tdBorderBottomWidth","width","height","offsetHeight","WPTB_DropHandle","thisElem","newElementProxy","includes","wptbDropHandle","wptbDropBorderMarker","wptbDropBorderMarkerTop","wptbDropBorderMarkerRight","wptbDropBorderMarkerBottom","wptbDropBorderMarkerLeft","ondragenter","ondragover","ondragleave","ondrop","getData","wptbMovingMode","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","console","log","onscroll","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","key","elemIdClass","prop","properties","affectedEl","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","elementsA","imgAlign","float","imageAlignmentSelect","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","imgWidth","imageWidthInputRange","imageWidthInputNumber","img","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","textAlign","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","optionsClass","children","buttons","size","n_Class","num","optionControls","wpColorPicker","change","ui","classe","ps","number","toString","wpColorPickerCheckChangeForTableStateSaving","slider","oninput","onchange","src","alt","href","linkHttpCheckChange","rel","removeAttribute","wptbImageFloatValue","jc","id","parentNodeSettingItem","onmouseup","hexToRgb","hex","result","exec","rgb","slice","getDragImageCustom","hostName","location","protocol","hostname","image","button","list","ulElem","par","listStyleTypeIndex","Number","article","keyCode","innerText","pText","replace","trim","selectedText","getSelectionText","wptbListItem","wptbButtonContainer","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","contentsForHeader","tdElements","textContent","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","elementOptionsPanelClear","elementOptionsGroup","originalEvent","wpPickerContainer","irisSquareHandle","uiSliderHandle","attribute","isId","input","newInput","url","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","elImage","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","imgSrc","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","div","classId","stopPropagation","onmouseover","wptbElementButtons","wptbTdBgColorSavedSet","inputId","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","clear","tableHeader","tableAdaptiveForMobile","wptbAdaptiveTableCheckbox","wptbAdaptiveTable","tableTopRowAsHeadSavedSet","wptbTopRowAsHeader","tableBorderColorWidthSavedSet","tableBorderColor","borderColor","tableBorderColorInput","tableBorderWidth","borderWidth","wptbTableBorderWidthSlider","wptbTableBorderWidthNumber","tableTd","applyInnerBorder","innerBorderCheckInput","wptbApplyInnerBorder","wptbTableInnerBorderSlider","wptbTableInnerBorderNumber","tableCells","tableInnerborderNumber","addInnerBorderSize","borderStyle","addCellPadding","addInnerBorder","styles","wptbPreviewTable","marginBottom","addBorderSize","cellPaddingSavedSet","wptbTableCellSlider","wptbTableCellNumber","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","clickOnFreeSpace","wptbHeader","wpcdFixedToolbar","hasAttribute","innerElements","el_L","wptbListItemReturn","styleDot","listItemKeyListener","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","ondragend","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","onbeforeunload","wptbSaveDisabled","wptbTableStateNumberSave","wptbTableStateNumberShow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","wptbSaveBtn","elSpaceBetween","spaceBetween","t_space","spaceParent","alert","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","k","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","wptbAdaptiveTableChoseBlock","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","l","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","onresize","wptbTableStateSaving","wptbNewPreviewTable","wptbHighlighted","cssForTdsWidthAutoValue","datawptbUndoredo","wptbLeftScrollPanelCellSetting","elText2","elP"],"mappings":"AAAA,IAAIA,2BAA2B,SAA3BA,wBAA2B,CAAWC,OAAX,EAAoBC,aAApB,EAAkD;AAAA,QAAfC,IAAe,uEAAR,KAAQ;;AAC7E,QAAIC,OAAOH,QAAQI,aAAR,EAAX;AAAA,QACIC,KADJ;AAAA,QAEIC,SAFJ;AAAA,QAGIJ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in.js","sourcesContent":["var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\r\n var node = element.getDOMElement(),\r\n index,\r\n listItems,\r\n copy;\r\n \r\n if ( kindIndexProt == undefined || copy == true ) {\r\n index = document.counter.nextIndex( element.kind );\r\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\r\n let elementIndexesArr = [];\r\n for( let i = 0; i < wptbElements.length; i++ ) {\r\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\r\n let infArr = wptbElements[i].className.match( regex );\r\n if( infArr ) {\r\n elementIndexesArr.push( infArr[1] );\r\n }\r\n }\r\n if( elementIndexesArr.length > 0 ) {\r\n let elementIndexMax = Math.max( ...elementIndexesArr );\r\n index = elementIndexMax + 1;\r\n } else { \r\n index = 1;\r\n }\r\n } else if ( kindIndexProt && ! copy ) {\r\n index = kindIndexProt.split('-')[1];\r\n }\r\n \r\n node.onmouseenter = function ( event ) {\r\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\r\n return;\r\n }\r\n \r\n let i, wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n node.classList.remove( 'wptb-ondragenter' );\r\n \r\n //wptbActionsField.addActionField( 1, node )\r\n \r\n if ( element.kind === 'button' ) {\r\n let a = node.querySelector( 'a' ),\r\n target = a.querySelector( 'div' );\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n WPTB_Helper.buttonsTinyMceInit( target );\r\n } else if (element.kind === 'text') {\r\n tinyMCE.init({\r\n target: node.childNodes[0],\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup : function( ed ) {\r\n ed.on( 'change', function(e) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n \r\n });\r\n \r\n ed.on( 'keydown', function(e) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n });\r\n ed.on( 'keyup', function(e) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n \r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n //editor.fire('focus');\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n \r\n } else {\r\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\r\n for ( let i = 0; i < listItems.length; i++ ) {\r\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\r\n }\r\n }\r\n\r\n \r\n };\r\n \r\n node.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n if( wptbActionsField.wptbActions && wptbActionsField.wptbActions.type != '1' ) {\r\n return;\r\n }\r\n \r\n wptbActionsField.leaveFromField( event, node, 1 );\r\n };\r\n \r\n let wptbActions = document.getElementsByClassName( 'wptb-actions' );\r\n if( wptbActions.length > 0 ) {\r\n wptbActions = wptbActions[0];\r\n \r\n }\r\n \r\n // Change data-title-column if the title was changed\r\n if( element.kind == 'text' ) {\r\n var observer = new MutationObserver( function( mutations ) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n });\r\n var config = { attributes: true, attributeFilter: ['style'] };\r\n observer.observe( element.getDOMElement(), config );\r\n }\r\n\r\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if ( node_wptb_element_kind_num ) {\r\n node.classList.remove( node_wptb_element_kind_num[0] );\r\n }\r\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\r\n node.classList.add( 'wptb-ph-element' );\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n } else {\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n }\r\n new WPTB_ElementOptions( element, index, kindIndexProt );\r\n\r\n document.counter.increment(element.kind);\r\n};","","var WPTB_ActionsField = function() {\n //this.wptbBorderMarker;\n this.wptbActions;\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n \n this.addActionField = ( actionType, thisNode ) => {\n let body = document.getElementsByTagName( 'body' )[0];\n \n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length != 0 ) {\n let previousNode = actions[0].activeElem;\n if( previousNode ) {\n previousNode.classList.remove( 'wptb-directlyhovered' );\n }\n \n while( actions.length != 0 ) {\n actions[0].parentNode.removeChild( actions[0] );\n }\n }\n \n if( actionType == 1 ) {\n \n let btnDelete, btnCopy, btnMove;\n\n btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n btnMove = document.createElement( 'span' ),\n actions = document.createElement( 'div' );\n\n actions.classList.add( 'wptb-actions' );\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\n btnMove.draggable = true;\n\n actions.appendChild( btnMove );\n actions.appendChild( btnCopy );\n actions.appendChild( btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n\n actions.type = 1;\n\n btnDelete.onclick = function( event ) {\n let act = event.target.parentNode.activeElem,\n el = act.parentNode;\n el.removeChild(act);\n\n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.actionsRemove();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n\n\n btnCopy.onclick = ( event ) => {\n let copy,\n infArr,\n type;\n let activeElement = event.target.parentNode.activeElem;\n let activeElementClone = activeElement.cloneNode( true );\n activeElementClone.classList.remove( 'wptb-directlyhovered' );\n infArr = activeElement.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n let td = activeElement.parentNode;\n if ( type == 'list' ) {\n var temp = [],\n srcList = activeElement.querySelectorAll('ul li .wptb-list-item-content');\n\n for (var i = 0; i < srcList.length; i++) {\n temp.push(srcList[i].innerHTML);\n }\n\n copy = new WPTB_List( temp, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'text' ) {\n copy = new WPTB_Text( activeElementClone.childNodes[0].innerHTML, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'image' ) {\n copy = new WPTB_Image( '', activeElement );\n \n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else {\n let text = activeElementClone.childNodes[0].querySelector( 'p' ).innerHTML;\n\n copy = new WPTB_Button( text, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n }\n\n WPTB_innerElementSet( copy.getDOMElement() );\n\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\n \n wptbActionsField.setParameters( activeElement );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnMove.ondragstart = ( event ) => {\n let dragImagesArr = WPTB_Helper.dragImagesArr(),\n actions = event.target.parentNode,\n activeElem = actions.activeElem,\n infArr,\n type;\n infArr = activeElem.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n activeElem.classList.add( 'wptb-moving-mode' );\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.activeElem;\n if( act.kind == 'text' ) {\n let thisRow = act.parentNode.parentNode;\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n //actions.style.display = 'none';\n this.actionsHide();\n };\n\n //actions.style.right = '-' + parseFloat( thisNode.offsetWidth ) + 'px';\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n } else if( actionType == 2 ) {\n let btnDelete,\n btnCopy,\n previous,\n i;\n\n btnDelete = document.createElement('span'),\n btnCopy = document.createElement('span'),\n actions = document.createElement('span')\n\n actions.classList.add('wptb-actions');\n btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');\n btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');\n\n actions.append( btnCopy, btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n \n let wptbDirectlyhovered = WPTB_Helper.findAncestor( thisNode, 'wptb-directlyhovered' );\n if( wptbDirectlyhovered ) {\n wptbDirectlyhovered.classList.remove( 'wptb-directlyhovered' );\n }\n\n actions.type = 2;\n\n btnDelete.onclick = ( event ) => {\n var action = event.target.parentNode, \n item = action.activeElem,\n parent = item.parentNode;\n let wptbActionsField = new WPTB_ActionsField( 4 );\n wptbActionsField.actionsRemove();\n parent.removeChild( item );\n WPTB_Helper.listItemsRecalculateIndex( parent );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnCopy.onclick = ( event ) => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopBegin = coordinatesElement.top;\n\n var listItem = event.target.parentNode.activeElem,\n content = listItem.querySelector( '.wptb-list-item-content' ),\n html = content.innerHTML;\n var duplicate = new WPTB_ListItem( html, listItem, true );\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), thisNode.nextSibling );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n\n let divcontent = thisNode.getElementsByClassName( 'wptb-list-item-content' );\n if( divcontent.length > 0 ) {\n divcontent = divcontent[0];\n }\n setTimeout( function(){\n divcontent.innerHTML = html;\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\n }, 5 );\n\n coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopEnd = coordinatesElement.top;\n\n if( coordinatesElementTopBegin != coordinatesElementTopEnd ) {\n let wptbActionsField = new WPTB_ActionsField( 2, thisNode );\n wptbActionsField.setParameters( thisNode );\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n }\n }\n \n this.setParameters = ( thisNode ) => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.display = 'block';\n }\n \n let coordinatesElement = thisNode.getBoundingClientRect();\n \n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\n let correctTop = () => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n }\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\n \n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\n\n// let wptbBorderMarkerTop = this.wptbBorderMarker.querySelector( '.wptb-border-marker-top' );\n// wptbBorderMarkerTop.style.width = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerRight = this.wptbBorderMarker.querySelector( '.wptb-border-marker-right' );\n// wptbBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 4 ) + 'px';\n// wptbBorderMarkerRight.style.left = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerBottom = this.wptbBorderMarker.querySelector( '.wptb-border-marker-bottom' );\n// wptbBorderMarkerBottom.style.width = wptbBorderMarkerTop.style.width;\n// wptbBorderMarkerBottom.style.top = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 3 ) + 'px';;\n//\n// let wptbBorderMarkerLeft = this.wptbBorderMarker.querySelector( '.wptb-border-marker-left' );\n// \n \n //this.wptbBorderMarker.style.display = 'block';\n this.wptbActions.style.display = 'block';\n thisNode.classList.add( 'wptb-directlyhovered' );\n \n wptbContainer.addEventListener( 'scroll', correctTop, false );\n }\n \n// if( actionType == 1 || actionType == 2 ) {\n// this.setParameters( thisNode );\n// }\n// } else {\n// this.wptbActions.style.display = 'block';\n// thisNode.classList.add( 'wptb-directlyhovered' );\n// }\n \n this.leaveFromField = ( event, node, actionType ) => {\n if( event.relatedTarget ) {\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\n if( ! this.wptbActions ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n this.wptbActions.onmouseleave = ( event ) => {\n if( event.relatedTarget != null && event.relatedTarget != this.wptbActions.activeElem &&\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered') != this.wptbActions.activeElem ) {\n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n\n if( this.wptbActions.type == 2 ) {\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\n\n wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\n }\n } else {\n return;\n }\n }\n\n return;\n } \n// else if( event.relatedTarget.classList.contains( 'wptb-drop-handle' ) ) {\n// let wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' );\n// if( wptbDropHandle.length > 0 ) {\n// wptbDropHandle = wptbDropHandle[0];\n// wptbDropHandle.onmouseleave\n// }\n// }\n }\n \n node.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n \n if( this.wptbActions.type == 2 ) {\n if( event.relatedTarget ) {\n if( event.relatedTarget.localName == 'ul' ) {\n //let wptbActionsField = new WPTB_ActionsField();\n\n this.addActionField( 1, event.relatedTarget.parentNode );\n\n this.setParameters( event.relatedTarget.parentNode );\n }\n }\n \n }\n }\n \n this.actionsRemove = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.parentNode.removeChild( this.wptbActions );\n }\n }\n \n this.actionsHide = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.opacity = 0;\n }\n }\n}","(function () {\r\n var WPTB_Builder = function () {\r\n var table_id = WPTB_Helper.detectMode();\r\n if ( table_id ) {\r\n var http = new XMLHttpRequest(),\r\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\r\n http.open('GET', urlSet, true);\r\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\r\n http.onreadystatechange = function (d) {\r\n if (this.readyState == 4 && this.status == 200) {\r\n var ans = JSON.parse(http.responseText);\r\n document.getElementById('wptb-setup-name').value = ans[0];\r\n \r\n if( ans[1] ) {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\r\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\r\n WPTB_Table();\r\n WPTB_LeftPanel();\r\n WPTB_Settings();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n return;\r\n }\r\n };\r\n http.send(null);\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n document.counter = new ElementCounters();\r\n document.select = new MultipleSelect();\r\n\r\n var initializer = WPTB_Initializer();\r\n settings = WPTB_Settings();\r\n };\r\n\r\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\r\n})();","var WPTB_Button = function( text, DOMElementProt ) {\r\n \r\n var DOMElement = document.createElement('div'),\r\n elButton = document.createElement('div'),\r\n el_B = document.createElement('a'),\r\n el_BDiv = document.createElement( 'div' ),\r\n el_BDivP = document.createElement( 'p' ),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n\r\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\r\n elButton.classList.add('wptb-button-wrapper');\r\n el_BDiv.classList.add('wptb-button');\r\n el_BDivP.innerHTML = text != undefined ? text : 'Button Text';\r\n \r\n // Creation of a new button when copying to avoid errors when assigning new event handlers.\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n }; \r\n var attributesContainer = [...DOMElementProt.attributes];\r\n if ( attributesContainer.length > 0 ) {\r\n for( let i = 0; i < attributesContainer.length; i++ ) {\r\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\r\n } \r\n }\r\n \r\n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\r\n if ( wptbButtonWrapper ) {\r\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\r\n if ( wptbButtonWrapAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\r\n if ( wptbButtonWrapAttributes[i].name == 'style') {\r\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButtonA = DOMElementProt.querySelector( 'a' );\r\n if ( wptbButtonA ) {\r\n var wptbButtonAttributes = [...wptbButtonA.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style' || \r\n wptbButtonAttributes[i].name == 'href' || \r\n wptbButtonAttributes[i].name == 'target' ) {\r\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButton = DOMElementProt.querySelector( '.wptb-button' );\r\n if ( wptbButton ) {\r\n var wptbButtonAttributes = [...wptbButton.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style') {\r\n el_BDiv.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n elButton.appendChild(el_B);\r\n el_B.appendChild( el_BDiv );\r\n el_BDiv.appendChild( el_BDivP );\r\n DOMElement.appendChild(elButton);\r\n \r\n \r\n \r\n this.kind = 'button';\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n \r\n return this;\r\n};","var WPTB_Cell = function (callback, DOMElement) {\r\n\r\n function highlightRow(td) {\r\n var parentRow = td.parentNode,\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\r\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\r\n }\r\n for (var i = 0; i < columnCount; i++) {\r\n\r\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\r\n var ttd = parentRow.getElementsByTagName('td')[i];\r\n if (ttd !== td) {\r\n ttd.classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n\r\n function highlightColumn(td) {\r\n\r\n var index,\r\n parentRow = td.parentNode;\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\r\n for (var i = 0; i < columnCount; i++) {\r\n if (parentRow.getElementsByTagName('td')[i] === td) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n for (var i = 0; i < rowCount; i++) {\r\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\r\n var tr = table.getElementsByTagName('tr')[i];\r\n if (tr.getElementsByTagName('td')[index] !== td) {\r\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n \r\n if( ! DOMElement ) {\r\n DOMElement = document.createElement(\"td\");\r\n\r\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\r\n\r\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\r\n\r\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\r\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\r\n } \r\n\r\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\r\n }\r\n\r\n DOMElement.draggable = false;\r\n if ( callback ) {\r\n DOMElement.onclick = callback;\r\n }\r\n \r\n WPTB_innerElementSet( DOMElement );\r\n \r\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( wptbPhElement.length > 0 ) {\r\n for( let i = 0; i < wptbPhElement.length; i++ ) {\r\n\r\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\r\n\r\n if ( wptbSpaceBetween.length > 0 ) {\r\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\r\n WPTB_Space( wptbSpaceBetween[j] );\r\n }\r\n }\r\n \r\n wptbPhElement[i].getDOMElement = function() {\r\n return wptbPhElement[i];\r\n }\r\n \r\n WPTB_innerElementSet( wptbPhElement[i] );\r\n \r\n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\r\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\r\n wptbPhElement[i].kind = wptbTypeElementArr[0];\r\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\r\n if ( wptbPhElement[i].kind == 'list' ) {\r\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\r\n if( wptbListItems.length > 0 ) {\r\n for ( let i = 0; i < wptbListItems.length; i++ ) {\r\n WPTB_ListItem( undefined, wptbListItems[i] );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n this.setCoords = function (y, x) {\r\n var el = this.getDOMElement();\r\n el.dataset.yIndex = y;\r\n el.dataset.xIndex = x;\r\n };\r\n\r\n this.getCoords = function () {\r\n var coords,\r\n el = this.getDOMElement();\r\n coords.x = el.dataset.xIndex;\r\n coords.y = el.dataset.yIndex;\r\n return coords;\r\n };\r\n\r\n this.appendElement = function (node) {\r\n getDOMElement().appendChild(node);\r\n };\r\n \r\n DOMElement.getCellDimensions = function() {\r\n let tdStyleObj = window.getComputedStyle( this, null );\r\n \r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n \r\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n \r\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\r\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\r\n \r\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\r\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\r\n \r\n let width = parseFloat( this.offsetWidth, 10 ) - \r\n parseFloat( tdPaddingLeft, 10 ) - \r\n parseFloat( tdPaddingRight, 10 ) -\r\n parseFloat( tdBorderLeftWidth, 10 ) -\r\n parseFloat( tdBorderRightWidth, 10 );\r\n \r\n let height = parseFloat( this.offsetHeight, 10 ) - \r\n parseFloat( tdPaddingTop, 10 ) - \r\n parseFloat( tdPaddingBottom, 10 ) -\r\n parseFloat( tdBorderTopWidth, 10 ) -\r\n parseFloat( tdBorderBottomWidth, 10 );\r\n \r\n return {\r\n width: width, \r\n height: height\r\n };\r\n }\r\n\r\n return this;\r\n};","var WPTB_DropHandle = function (thisElem, e) {\r\n \r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n \r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\r\n wptbDropHandle = document.createElement( 'div' );\r\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\r\n \r\n wptbDropBorderMarker = document.createElement( 'div' );\r\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\r\n \r\n let wptbDropBorderMarkerTop = document.createElement( 'div' ),\r\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\r\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\r\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\r\n \r\n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\r\n \r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\r\n \r\n let body = document.getElementsByTagName( 'body' );\r\n if ( body.length > 0 ) {\r\n body[0].appendChild( wptbDropHandle );\r\n body[0].appendChild( wptbDropBorderMarker );\r\n }\r\n \r\n wptbDropHandle.ondragenter = function () {\r\n\r\n }\r\n\r\n wptbDropHandle.ondragover = function (e) {\r\n e.preventDefault();\r\n }\r\n\r\n wptbDropHandle.ondragleave = function () {\r\n\r\n }\r\n wptbDropHandle.ondrop = function (e) {\r\n e.preventDefault();\r\n let element;\r\n \r\n if ( e.dataTransfer.getData('wptbElement') ) {\r\n element = newElementProxy( e.dataTransfer.getData('wptbElement') );\r\n element = element.getDOMElement();\r\n } else {\r\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\r\n element.classList.remove( 'wptb-moving-mode' );\r\n element.classList.remove( 'wptb-moving-into-same-elem' );\r\n element.wptbMovingMode = 1;\r\n }\r\n \r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n thisElem = wptbDropHandle.getDOMParentElement();\r\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n }\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n \r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n \r\n WPTB_innerElementSet(element);\r\n console.log(element);\r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n element.wptbMovingMode == undefined;\r\n }\r\n }\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n wptbContainer.onscroll = function() {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n } else {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\r\n return;\r\n }\r\n \r\n let thisRow;\r\n if ( thisElem.localName == 'td' ) {\r\n thisRow = thisElem.parentNode;\r\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\r\n thisRow = thisElem.parentNode.parentNode;\r\n }\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let indics = e.dataTransfer.types;\r\n let notDragEnter = false;\r\n for ( let i = 0; i < indics.length; i++ ) {\r\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\r\n if ( infArr && infArr[1] != 'text' ) {\r\n notDragEnter = true;\r\n break;\r\n }\r\n }\r\n if( notDragEnter ) {\r\n return;\r\n }\r\n }\r\n \r\n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\r\n let height = thisElem.offsetHeight,\r\n coordinatesElement = thisElem.getBoundingClientRect(),\r\n left = parseFloat( coordinatesElement.left ),\r\n top;\r\n wptbDropHandle.style.left = left + 'px';\r\n \r\n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\r\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\r\n if( thisElem == elementDrag ) {\r\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\r\n } else {\r\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\r\n }\r\n }\r\n \r\n wptbDropHandle.getDOMParentElement = function() {\r\n return thisElem;\r\n }\r\n \r\n wptbDropHandle.style.display = 'block';\r\n wptbDropBorderMarker.style.display = 'block';\r\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\r\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\r\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\r\n wptbDropHandle.dataset.text = 'Above Element';\r\n if ( y > height/2 ) {\r\n top = parseFloat( coordinatesElement.top ) + height - 1;\r\n wptbDropHandle.dataset.text = 'Below Element';\r\n }\r\n } else {\r\n wptbDropHandle.dataset.text = 'Drop Here';\r\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\r\n }\r\n wptbDropHandle.style.top = top + 'px';\r\n\r\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\r\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\r\n\r\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\r\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\r\n\r\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\r\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\r\n\r\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\r\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\r\n}","var ElementCounters = function () {\r\n\r\n\tvar priv = [];\r\n\tpriv['text'] = 0;\r\n\tpriv['image'] = 0;\r\n\tpriv['list'] = 0;\r\n\tpriv['button'] = 0;\r\n\r\n\tthis.increment = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpriv[key]++;\r\n\t}\r\n\r\n\tthis.nextIndex = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn priv[key] + 1;\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\r\n\r\n var node = element.getDOMElement(), elemIdClass;\r\n\r\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\r\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\r\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\r\n\r\n var properties = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < properties.length; i++) {\r\n properties[i].dataset.element = elemIdClass;\r\n }\r\n\r\n prop.classList.add(elemIdClass);\r\n document.getElementById(\"element-options-group\").appendChild(prop);\r\n \r\n if ( kindIndexProt ) {\r\n if ( element.kind == 'button' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\r\n wptbButtonWrapper,\r\n wptbButtonA,\r\n wptbButton,\r\n wptbSize;\r\n \r\n if ( affectedEl ) {\r\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\r\n }\r\n \r\n if( wptbSize && Array.isArray( wptbSize ) ) {\r\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\r\n \r\n for ( var i = 0; i < b.length; i++ ) {\r\n b[i].classList.remove( 'selected' );\r\n \r\n if ( b[i].innerHTML == wptbSize[1] ) {\r\n b[i].classList.add( 'selected' );\r\n }\r\n }\r\n }\r\n \r\n if( affectedEl ) {\r\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\r\n \r\n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\r\n \r\n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\r\n }\r\n \r\n if ( wptbButtonWrapper ) {\r\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\r\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\r\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\r\n selectOptionVal;\r\n \r\n if ( buttonAlignment == 'flex-start' ) {\r\n selectOptionVal = 'left';\r\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\r\n selectOptionVal = 'center';\r\n } else if ( buttonAlignment == 'flex-end' ) {\r\n selectOptionVal = 'right';\r\n }\r\n \r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == selectOptionVal ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n }\r\n \r\n if ( wptbButtonA.length > 0 ) {\r\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \r\n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\r\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\r\n \r\n \r\n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\r\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\r\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\r\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\r\n \r\n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\r\n\r\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\r\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\r\n\r\n buttonHrefInput.value = buttonHref;\r\n\r\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\r\n buttonLinkTargetInput.checked = true;\r\n }\r\n \r\n buttotIdInput.value = buttonId;\r\n }\r\n \r\n if( wptbButton ) {\r\n let buttonTextColor = wptbButton[0].style.color,\r\n buttonColor = wptbButton[0].style.backgroundColor,\r\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\r\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\r\n \r\n \r\n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\r\n \r\n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\r\n \r\n }\r\n } else if ( element.kind == 'image' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n let elementsA = affectedEl[0].getElementsByTagName( 'a' );\r\n if ( elementsA.length > 0 ) {\r\n let a = elementsA[0];\r\n\r\n if ( a ) {\r\n // set select according to the alignment of the image\r\n let imgAlign;\r\n if( a.style.float == 'none' ) {\r\n imgAlign = 'center';\r\n } else {\r\n imgAlign = a.style.float;\r\n }\r\n let imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\r\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\r\n\r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == imgAlign ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n\r\n // set text link for input field of setting panel\r\n let imageLinkHref = a.getAttribute( 'href' ),\r\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\r\n if ( imageLinkHref ) {\r\n inputImageLink.value = imageLinkHref;\r\n }\r\n\r\n // set checkbox for target of link \r\n let imageLinkTarget = a.getAttribute( 'target' ),\r\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\r\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\r\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\r\n\r\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n\r\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\r\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\r\n\r\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\r\n imageLinkTargetInput.checked = true;\r\n }\r\n\r\n // set value for input fields of image size\r\n let imgWidth = a.style.width;\r\n if ( imgWidth ) {\r\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\r\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\r\n\r\n imageWidthInputRange.value = parseInt( imgWidth );\r\n imageWidthInputNumber.value = parseInt( imgWidth );\r\n }\r\n\r\n let img = a.getElementsByTagName( 'img' );\r\n if ( img.length > 0 ) {\r\n // set value for input field of alternative text image\r\n let imgAlternativeText = img[0].getAttribute('alt'),\r\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\r\n\r\n imageAlternativeTextInput.value = imgAlternativeText;\r\n }\r\n }\r\n }\r\n }\r\n } else if ( element.kind == 'text' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n let elementFontSize = affectedEl[0].style.fontSize,\r\n elementTextColor = affectedEl[0].style.color;\r\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\r\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\r\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\r\n\r\n textFontSizeInputRange.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\r\n textFontSizeInputNumber.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\r\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\r\n }\r\n } else if ( element.kind == 'list' ) {\r\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( elementList.length > 0 ) {\r\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\r\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\r\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\r\n \r\n let elementListItem = elementList[0].querySelectorAll( 'li' );\r\n if ( elementListItem.length > 0 ) {\r\n let listItemP = elementListItem[0].querySelector( 'p' );\r\n let listItemPClasses = listItemP.classList;\r\n //listItemPClasses = [...listItemPClasses];\r\n if ( listItemPClasses.length > 0 ) {\r\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\r\n if ( elementListClassSelect ) {\r\n elementListClassSelect.value = 'unordered';\r\n \r\n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\r\n for ( let i = 0; i < 10; i++ ) {\r\n if ( listIconSelectLabel.nodeType == '1' ) {\r\n break;\r\n } else {\r\n listIconSelectLabel = listIconSelectLabel.nextSibling;\r\n }\r\n }\r\n if ( listIconSelectLabel ) {\r\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\r\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\r\n listIconSelectLabel.style.display = 'flex';\r\n }\r\n \r\n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\r\n if ( elementListStyleTypeSelect ) {\r\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\r\n \r\n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\r\n elementListStyleTypeSelect.value = 'disc';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\r\n elementListStyleTypeSelect.value = 'circle';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\r\n elementListStyleTypeSelect.value = 'square';\r\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\r\n elementListStyleTypeSelect.value = 'none';\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\r\n if ( elementListItemContent.length > 0 ) {\r\n let listItemPTextAlignArr = [];\r\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\r\n let p = elementListItemContent[i].querySelector( 'p' );\r\n if ( p ) {\r\n if ( p.style.textAlign ) {\r\n listItemPTextAlignArr.push( p.style.textAlign );\r\n } else {\r\n listItemPTextAlignArr.push( 'left' );\r\n }\r\n }\r\n \r\n }\r\n \r\n let listItemPTextAlignLeftCount = 0,\r\n listItemPTextAlignCenterCount = 0,\r\n listItemPTextAlignRightCount = 0;\r\n \r\n if ( listItemPTextAlignArr.length > 0 ) {\r\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\r\n if ( listItemPTextAlignArr[i] ) {\r\n if ( listItemPTextAlignArr[i] == 'left' ) {\r\n listItemPTextAlignLeftCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\r\n listItemPTextAlignCenterCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\r\n listItemPTextAlignRightCount++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\r\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\r\n \r\n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'left';\r\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'center';\r\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'right';\r\n }\r\n }\r\n } \r\n }\r\n }\r\n\r\n node.onclick = function () {\r\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\r\n optionsClass = '.wptb-' + infArr[2] + 'options' +\r\n '.wptb-options-' + infArr[1];\r\n\r\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\r\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\r\n document.getElementById(\"element-options-group\").style.display = 'block';\r\n\r\n var children = document.getElementById(\"element-options-group\").childNodes;\r\n for (var i = 0; i < children.length; i++) {\r\n if (children[i].style)\r\n children[i].style.display = 'none';\r\n }\r\n\r\n document.querySelector(optionsClass).style.display = 'block';\r\n\r\n //var listStyleType, textAlign;\r\n\r\n// switch (element.kind) {\r\n\r\n// case 'text':\r\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\r\n// prop.querySelector('[type=number][data-type=font-size]').value\r\n// = prop.querySelector('[type=range][data-type=font-size]').value\r\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\r\n// break;\r\n// case 'list':\r\n// textAlign = node.querySelector('li p').style.textAlign;\r\n// listStyleType = node.querySelector('li').style.listStyleType;\r\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\r\n// console.log(textAlign);\r\n// console.log(listStyleType);\r\n// console.log(listStyleType);\r\n// console.log(prop);\r\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\r\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\r\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\r\n// }\r\n// break;\r\n// case 'image':\r\n// break;\r\n// case 'button':\r\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\r\n// break;\r\n//\r\n// }\r\n };\r\n\r\n if (element.kind == 'button') {\r\n //We must add this special kind of property, since it is triggered with click event\r\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\r\n\r\n for (var i = 0; i < buttons.length; i++) {\r\n buttons[i].onclick = function () {\r\n var size = this.innerHTML,\r\n n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\r\n affectedEl.classList.remove('wptb-size-S');\r\n affectedEl.classList.remove('wptb-size-M');\r\n affectedEl.classList.remove('wptb-size-L');\r\n affectedEl.classList.remove('wptb-size-XL');\r\n affectedEl.classList.add('wptb-size-' + size);\r\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\r\n for (var i = 0; i < b.length; i++) {\r\n b[i].classList.remove('selected');\r\n }\r\n this.classList.add('selected');\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n\r\n var optionControls = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < optionControls.length; i++) {\r\n if (optionControls[i].classList.contains('wptb-color-picker')) {\r\n jQuery(optionControls[i]).wpColorPicker({\r\n change: function (event, ui) {\r\n var parent = event.target, classe, type, ps, number;\r\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\r\n type = classe[1];\r\n number = classe[2];\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];\r\n if ( type == 'button' ) {\r\n if (parent.dataset.type == 'button-text-color') {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.color = ui.color.toString();\r\n } else {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();\r\n }\r\n } else if( type == 'list' ) {\r\n let ps = affectedEl.querySelectorAll( 'p' );\r\n if( ps.length > 0 ) {\r\n for ( let i = 0; i < ps.length; i++ ) {\r\n ps[i].style.color = ui.color.toString();\r\n }\r\n }\r\n } else {\r\n affectedEl.style.color = ui.color.toString();\r\n }\r\n \r\n //console.log(event);\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n }\r\n });\r\n }\r\n\r\n if ( optionControls[i].dataset.type === 'font-size' ) {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange( event );\r\n }\r\n }\r\n\r\n if (optionControls[i].dataset.type === 'image-size') {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange( event );\r\n }\r\n }\r\n\r\n optionControls[i].onchange = function ( event ) {\r\n var n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\r\n val = this.value;\r\n\r\n switch ( this.dataset.type ) {\r\n case 'src':\r\n var img = affectedEl.getElementsByTagName(\"img\")[0];\r\n img.src = this.value;\r\n break;\r\n case 'alternative-text':\r\n var img = affectedEl.getElementsByTagName('img')[0];\r\n img.alt = this.value;\r\n break;\r\n case 'image-link':\r\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n break;\r\n case 'image-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'image-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\r\n }\r\n break;\r\n case 'image-size':\r\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\r\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;\r\n break;\r\n case 'image-alignment':\r\n let wptbImageFloatValue = '';\r\n if( this.value == 'center' ) {\r\n wptbImageFloatValue = 'none';\r\n } else {\r\n wptbImageFloatValue = this.value;\r\n }\r\n affectedEl.querySelector( '.wptb-image-wrapper a' ).style.float = wptbImageFloatValue;\r\n break;\r\n case 'font-size':\r\n affectedEl.style.fontSize = val + 'px';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0].value = this.value;\r\n break;\r\n case 'button-alignment':\r\n var jc = '';\r\n if (this.value == 'left') {\r\n jc = 'start';\r\n } else if (this.value == 'right') {\r\n jc = 'flex-end';\r\n } else {\r\n jc = 'center';\r\n }\r\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\r\n break;\r\n case 'button-link':\r\n if ( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\r\n }\r\n break;\r\n case 'button-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'button-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\r\n }\r\n break;\r\n case 'button-id':\r\n if( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\r\n }\r\n case 'button-color':\r\n break;\r\n case 'list-alignment':\r\n let listItems = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItems.length; i++) {\r\n let p = listItems[i].querySelector( 'p' );\r\n if ( p ) {\r\n p.style.textAlign = this.value;\r\n }\r\n }\r\n break;\r\n case 'list-class':\r\n let parentNode = event.target\r\n .parentNode\r\n .parentNode\r\n .querySelector('[data-type=list-style-type]')\r\n .parentNode,\r\n parentNodeSettingItem = parentNode.parentNode;\r\n if (val == 'unordered') {\r\n parentNode.style.display = 'flex';\r\n \r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\r\n let listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-disc' );\r\n }\r\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\r\n } else {\r\n parentNode.style.display = 'none';\r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n }\r\n }\r\n break;\r\n case 'list-style-type':\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\r\n }\r\n break;\r\n }\r\n \r\n \r\n if( event.target.classList.contains( 'wptb-text-font-size-slider' ) || event.target.classList.contains( 'wptb-image-size-slider' ) ) {\r\n event.target.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n } else {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n};","var WPTB_Helper = {\r\n hexToRgb: function( hex ) {\r\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\r\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\r\n },\r\n rgbToHex: function ( rgb ) {\r\n var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\r\n\r\n return ( rgb && rgb.length === 4 ) ? \"#\" +\r\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\r\n },\r\n getDragImageCustom: function ( type ) {\r\n let hostName = location.protocol + '//' + location.hostname;\r\n let img = document.createElement( 'img' );\r\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\r\n return img;\r\n },\r\n dragImagesArr: function() {\r\n return {\r\n text: WPTB_Helper.getDragImageCustom( 'text' ),\r\n image: WPTB_Helper.getDragImageCustom( 'image' ),\r\n button: WPTB_Helper.getDragImageCustom( 'button' ),\r\n list: WPTB_Helper.getDragImageCustom( 'list' )\r\n };\r\n },\r\n listItemsRecalculateIndex: function( ulElem ) {\r\n let par = ulElem.querySelectorAll( 'p' );\r\n if ( par.length > 0 ) {\r\n for ( let i = 0; i < par.length; i++ ) {\r\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\r\n }\r\n }\r\n },\r\n listItemsTinyMceInit: function( listItem ) {\r\n tinyMCE.init({\r\n target: listItem,\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup: function(ed) {\r\n ed.on('keydown', function(e) {\r\n let article = e.target.parentNode;\r\n if ( e.keyCode == 13 ) {\r\n e.preventDefault();\r\n let text = e.target.innerHTML;\r\n let duplicate = new WPTB_ListItem( text, article, true );\r\n \r\n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\r\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\r\n e.target.querySelector( 'p' ).innerText = 'New List Item';\r\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\r\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\r\n \r\n return;\r\n \r\n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\r\n let p = e.target.querySelector( 'p' );\r\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\r\n pText = pText.replace( /\\s+/g, ' ' ).trim();\r\n pText = pText.replace( / /g, '').trim();\r\n \r\n if( pText == '' ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n } else {\r\n let selectedText = WPTB_Helper.getSelectionText();\r\n selectedText = selectedText.replace( /\\s+/g, ' ' ).trim();\r\n selectedText = selectedText.replace( / /g, '' ).trim();\r\n if( selectedText == pText ) {\r\n e.preventDefault();\r\n e.target.querySelector( 'p' ).innerText = '\\n';\r\n }\r\n }\r\n }\r\n \r\n let wptbListItem = e.target.parentNode;\r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 2, wptbListItem );\r\n\r\n wptbActionsField.setParameters( wptbListItem );\r\n });\r\n \r\n ed.on( 'keyup', function( e ) {\r\n let wptbListItem = e.target.parentNode;\r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 2, wptbListItem );\r\n\r\n wptbActionsField.setParameters( wptbListItem );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n buttonsTinyMceInit: function( target ) {\r\n tinyMCE.init({\r\n target: target,\r\n inline: true,\r\n plugins: \"link\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n toolbar: 'bold italic strikethrough',\r\n setup : function(ed) {\r\n ed.on( 'keydown', function(e) {\r\n if (e.keyCode == 13) {\r\n e.preventDefault();\r\n }\r\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 1, wptbButtonContainer );\r\n\r\n wptbActionsField.setParameters( wptbButtonContainer );\r\n });\r\n \r\n ed.on( 'keyup', function(e) {\r\n let wptbButtonContainer = WPTB_Helper.findAncestor( target, 'wptb-button-container' );\r\n \r\n let wptbActionsField = new WPTB_ActionsField();\r\n\r\n wptbActionsField.addActionField( 1, wptbButtonContainer );\r\n\r\n wptbActionsField.setParameters( wptbButtonContainer );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n },\r\n linkHttpCheckChange: function( link ) {\r\n if ( link ) {\r\n if ( link.indexOf( 'http://' ) == -1 && link.indexOf( 'https://' ) == -1 ) {\r\n let linkArr = link.split( '/' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n return document.location.protocol + '//' + linkClean;\r\n } else { \r\n return link;\r\n }\r\n } else {\r\n return '';\r\n }\r\n },\r\n dataTitleColumnSet: function( table ) {\r\n let rows = table.rows,\r\n rowHead = rows[0];\r\n let computedStyleRowHead = getComputedStyle(rowHead);\r\n \r\n let rowHeadChildren = rowHead.children;\r\n let contentsForHeader = {};\r\n for( let i = 0; i < rowHeadChildren.length; i++ ) {\r\n let tdElements = rowHeadChildren[i].children;\r\n for( let j = 0; j < tdElements.length; j++ ) {\r\n let element = tdElements[j];\r\n if( element.classList.contains( 'wptb-ph-element' ) ) {\r\n let infArr = element.className.match( /wptb-element-(.+)-(\\d+)/i );\r\n if( infArr[1] == 'text' ) {\r\n let p = element.querySelector( 'p' ),\r\n textContent = p.textContent,\r\n textAlign = p.style.textAlign;\r\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = [textContent, element.style.fontSize, \r\n element.style.color, computedStyleRowHead.backgroundColor, textAlign];\r\n break;\r\n }\r\n }\r\n }\r\n if( ! contentsForHeader[rowHeadChildren[i].dataset.xIndex] ) {\r\n contentsForHeader[rowHeadChildren[i].dataset.xIndex] = ['', '', \r\n '', computedStyleRowHead.backgroundColor, ''];\r\n }\r\n }\r\n for ( let i = 1; i < rows.length; i++ ) {\r\n let thisRow = rows[i],\r\n thisRowChildren = thisRow.children;\r\n for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n if ( contentsForHeader[thisRowChildren[j].dataset.xIndex] ) {\r\n thisRowChildren[j].dataset.wptbTitleColumn = contentsForHeader[thisRowChildren[j].dataset.xIndex][0];\r\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = contentsForHeader[thisRowChildren[j].dataset.xIndex][1];\r\n thisRowChildren[j].dataset.wptbTitleColumnColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][2];\r\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = contentsForHeader[thisRowChildren[j].dataset.xIndex][3];\r\n thisRowChildren[j].dataset.wptbTitleAlign = contentsForHeader[thisRowChildren[j].dataset.xIndex][4];\r\n } else {\r\n thisRowChildren[j].dataset.wptbTitleColumn = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnFontSize = '';\r\n thisRowChildren[j].dataset.wptbTitleColumnColor = '';\r\n thisRowChildren[j].dataset.wptbTitleBackgroundColor = '';\r\n thisRowChildren[j].dataset.wptbTitleAlign = '';\r\n }\r\n }\r\n }\r\n },\r\n findAncestor: function(el, cls) {\r\n while ((el = el.parentElement) && !el.classList.contains(cls));\r\n return el;\r\n },\r\n getSelectionText: function() {\r\n var txt = '';\r\n if (txt = window.getSelection) {\r\n txt = window.getSelection().toString();\r\n } else {\r\n txt = document.selection.createRange().text;\r\n }\r\n return txt;\r\n },\r\n settingsPanelClear: function() {\r\n document.getElementById( 'wptb-adaptive-table-checkbox' ).checked = false;\r\n document.getElementById( 'wptb-top-row-as-header' ).checked = false;\r\n document.getElementById( 'wptb-table-border-slider' ).value = 0;\r\n document.getElementById( 'wptb-table-border-number' ).value = 0;\r\n document.getElementById( 'wptb-inner-border-check' ).checked = false;\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n document.getElementById( 'wptb-table-inner-border-slider' ).value = 1;\r\n document.getElementById( 'wptb-table-inner-border-number' ).value = 1;\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-border-color', true );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-table-header-bg', true );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-even-row-bg', true );\r\n \r\n WPTB_Helper.wpColorPickerClear( 'wptb-odd-row-bg', true );\r\n \r\n document.getElementById( 'wptb-table-cell-slider' ).value = 15;\r\n document.getElementById( 'wptb-table-cell-number' ).value = 15;\r\n },\r\n elementOptionsPanelClear: function() {\r\n let elementOptionsGroup = document.getElementById( 'element-options-group' );\r\n if( elementOptionsGroup ) {\r\n elementOptionsGroup.innerHTML = '';\r\n }\r\n },\r\n wpColorPickerCheckChangeForTableStateSaving: function( event ) {\r\n if( event.originalEvent.type == 'external' ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( event.target, 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n if( event.originalEvent.type == 'square' ) {\r\n let irisSquareHandle = wpPickerContainer.getElementsByClassName( 'iris-square-handle' );\r\n if( irisSquareHandle.length > 0 ) {\r\n irisSquareHandle = irisSquareHandle[0];\r\n irisSquareHandle.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n } else if( event.originalEvent.type == 'strip' ) {\r\n let uiSliderHandle = wpPickerContainer.getElementsByClassName( 'iris-slider-offset' );\r\n if( uiSliderHandle.length > 0 ) {\r\n uiSliderHandle = uiSliderHandle[0];\r\n uiSliderHandle.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n wpColorPickerClear: function( attribute, isId ) {\r\n let input;\r\n if( isId ) {\r\n input = [document.getElementById( attribute )];\r\n input.length = 1;\r\n } else {\r\n input = document.getElementsByClassName( attribute );\r\n }\r\n for( let i = 0; i < input.length; i++ ) {\r\n let wpPickerContainer = WPTB_Helper.findAncestor( input[i], 'wp-picker-container' );\r\n if( wpPickerContainer ) {\r\n let parent = wpPickerContainer.parentNode;\r\n parent.removeChild( wpPickerContainer );\r\n let newInput = document.createElement( 'input' );\r\n if( isId ) {\r\n newInput.setAttribute( 'id', attribute );\r\n } else {\r\n newInput.classList.add( 'wptb-element-property', attribute );\r\n }\r\n newInput.value = \"\";\r\n parent.appendChild( newInput );\r\n }\r\n }\r\n },\r\n detectMode: function() {\r\n var url = window.location.href,\r\n regex = new RegExp('[?&]table(=([^&#]*)|&|#|$)'),\r\n results = regex.exec(url);\r\n if (!results) return false;\r\n if (!results[2]) return '';\r\n return decodeURIComponent(results[2].replace(/\\+/g, ' '));\r\n },\r\n getColumnWidth: function( table, cell ) {\r\n let xIndex = cell.dataset.xIndex;\r\n let xIndexes = table.querySelectorAll( '[data-x-index=\"' + xIndex + '\"]' );\r\n let cellWidth = cell.getCellDimensions().width;\r\n for( let i = 0; i < xIndexes.length; i++ ) {\r\n if( cellWidth > xIndexes[i].getCellDimensions().width ) {\r\n cellWidth = xIndexes[i].getCellDimensions().width;\r\n }\r\n }\r\n return cellWidth;\r\n },\r\n getRowHeight: function( table, cell ) {\r\n let yIndex = cell.dataset.yIndex;\r\n let yIndexes = table.querySelectorAll( '[data-y-index=\"' + yIndex + '\"]' );\r\n let cellHeight = cell.getCellDimensions().height;\r\n for( let i = 0; i < yIndexes.length; i++ ) {\r\n if( cellHeight > yIndexes[i].getCellDimensions().height ) {\r\n cellHeight = yIndexes[i].getCellDimensions().height;\r\n }\r\n }\r\n return cellHeight;\r\n }\r\n}\r\n","var WPTB_Image = function ( src, DOMElementProt ) {\r\n let DOMElement,\r\n elImage,\r\n kindIndexProt = undefined,\r\n copy = false;\r\n if ( DOMElementProt == undefined ) {\r\n DOMElement = document.createElement( 'div' );\r\n elImage = document.createElement( 'div' );\r\n\t let anchor = document.createElement( 'a' ),\r\n\t img = document.createElement( 'img' );\r\n anchor.style.display = 'block';\r\n anchor.appendChild( img );\r\n DOMElement.classList.add( 'wptb-image-container' );\r\n elImage.classList.add( 'wptb-image-wrapper' );\r\n elImage.appendChild( anchor );\r\n DOMElement.appendChild( elImage );\r\n \r\n anchor.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n \r\n file_frame = wp.media.frames.file_frame = wp.media({\r\n\t\ttitle: 'Select a image to upload',\r\n\t\tbutton: {\r\n text: 'Use this image'\r\n\t\t},\r\n\t\tmultiple: false\r\n });\r\n // When an image is selected, run a callback.\r\n file_frame.on('select', function () {\r\n attachment = file_frame.state().get('selection').first().toJSON();\r\n let imgSrc = attachment.url;\r\n let linkArr = imgSrc.split( ':' ),\r\n linkClean;\r\n if ( Array.isArray( linkArr ) && linkArr.length > 0 ) {\r\n linkClean = linkArr[linkArr.length - 1];\r\n }\r\n img.src = linkClean;\r\n img.height = attachment.height;\r\n img.width = attachment.width;\r\n img.style.width = '100%';\r\n\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n });\r\n // Finally, open the modal\r\n if (src == undefined) {\r\n file_frame.open();\r\n } else {\r\n img.src = src;\r\n }\r\n } else {\r\n DOMElement = DOMElementProt.cloneNode( true );\r\n \r\n DOMElement.getElementsByTagName( 'a' )[0].onclick = function(e) {\r\n e.preventDefault();\r\n };\r\n \r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n }\r\n \r\n this.kind = 'image';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\tapplyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n\treturn this;\r\n};","var WPTB_Initializer = function () {\r\n\r\n const MIN_COLUMNS = 1,\r\n MIN_ROWS = 1,\r\n MAX_COLUMNS = 30,\r\n MAX_ROWS = 30;\r\n\r\n var tableGenerator = document.body;\r\n columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],\r\n columnsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[0],\r\n rowsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[1],\r\n rowsIncrementButton = tableGenerator.getElementsByClassName('wptb-input-number-increment')[1],\r\n columnsInput = document.getElementById('wptb-columns-number'),\r\n rowsInput = document.getElementById('wptb-rows-number');\r\n \r\n columnsDecrementButton.onclick = function () {\r\n if (columnsInput.value > MIN_COLUMNS) {\r\n columnsInput.value--;\r\n }\r\n };\r\n\r\n columnsIncrementButton.onclick = function () {\r\n if (columnsInput.value < MAX_COLUMNS) {\r\n columnsInput.value++;\r\n }\r\n };\r\n\r\n rowsDecrementButton.onclick = function () {\r\n if (rowsInput.value > MIN_ROWS) {\r\n rowsInput.value--;\r\n }\r\n };\r\n\r\n rowsIncrementButton.onclick = function () {\r\n if (rowsInput.value < MAX_ROWS) {\r\n rowsInput.value++;\r\n }\r\n };\r\n\r\n document.getElementById('wptb-generate-table').onclick = function () {\r\n var columns = document.getElementById('wptb-columns-number').value,\r\n rows = document.getElementById('wptb-rows-number').value;\r\n\r\n WPTB_Table(columns, rows);\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n};\r\n","var WPTB_innerElementSet = function ( element ) {\r\n \r\n function newElementProxy(el) {\r\n if (el == 'list') {\r\n return new WPTB_List();\r\n } else if (el == 'image') {\r\n return new WPTB_Image();\r\n } else if (el == 'text') {\r\n return new WPTB_Text();\r\n } else if (el == 'button') {\r\n return new WPTB_Button();\r\n }\r\n }\r\n \r\n element.ondragenter = function (e) {\r\n var div;\r\n if ( e.dataTransfer.types.indexOf( 'wptbelement' ) == -1 && e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) == -1 ) {\r\n return;\r\n }\r\n WPTB_DropHandle(this, e);\r\n \r\n element.classList.add( 'wptb-ondragenter' );\r\n }\r\n element.ondragover = function (e) {\r\n e.preventDefault();\r\n WPTB_DropHandle(this, e);\r\n }\r\n element.ondragleave = function () {\r\n \r\n }\r\n element.ondrop = function(e) {\r\n this.classList.remove( 'wptb-ondragenter' );\r\n let element, classId;\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n if (!e.dataTransfer.getData('wptbElement') && !e.dataTransfer.getData('node')) {\r\n return;\r\n }\r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length > 0 ) {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n }\r\n if( document.getElementsByClassName( 'wptb-drop-border-marker' ).length > 0 ) {\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n\r\n if ( e.dataTransfer.getData( 'wptbElement' ) ) {\r\n element = newElementProxy( e.dataTransfer.getData( 'wptbElement' ) );\r\n element = element.getDOMElement();\r\n } else {\r\n classId = e.dataTransfer.getData( 'node' );\r\n element = document.getElementsByClassName( classId )[0];\r\n //element.classList.remove( 'wptb-moving-mode' );\r\n }\r\n \r\n if( wptbDropHandle.style.display == 'block' ) {\r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n\r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n let thisRow = td.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n } else {\r\n return;\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n\r\n WPTB_innerElementSet( element );\r\n \r\n if( ! element.classList.contains( 'wptb-image-container' ) || element.classList.contains( 'wptb-moving-mode' ) ) {\r\n element.classList.remove( 'wptb-moving-mode' );\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } \r\n return true;\r\n }\r\n element.onmouseover = function(e) {\r\n element.classList.remove( 'wptb-ondragenter' );\r\n }\r\n}","var WPTB_LeftPanel = function () {\r\n\r\n var table = document.getElementsByClassName('wptb-preview-table')[0],\r\n wptbElementButtons = document.getElementsByClassName('wptb-element');\r\n \r\n function wptbTdBgColorSavedSet( inputId, trNumber ) {\r\n if ( trNumber > 3 ) return;\r\n if( table ) {\r\n let tableRows = table.getElementsByTagName('tr');\r\n if ( tableRows.length > trNumber ) {\r\n let trBackgroundColor = tableRows[trNumber].style.backgroundColor;\r\n var wptbEvenRowBg = document.getElementById(inputId);\r\n if ( wptbEvenRowBg && trBackgroundColor ) {\r\n wptbEvenRowBg.value = WPTB_Helper.rgbToHex( trBackgroundColor );\r\n }\r\n }\r\n }\r\n \r\n }\r\n \r\n wptbTdBgColorSavedSet( 'wptb-even-row-bg', 1 );\r\n jQuery('#wptb-even-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n console.log(event);\r\n console.log(this);\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 1; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName('td');\r\n for ( let j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n },\r\n\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-odd-row-bg', 2 );\r\n jQuery('#wptb-odd-row-bg').wpColorPicker({\r\n change: function ( event, ui ) {\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = ui.color.toString();\r\n }\r\n \r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n clear: function(){\r\n var tableRows = table.getElementsByTagName('tr');\r\n for ( let i = 2; i < tableRows.length; i += 2 ) {\r\n tableRows[i].style.backgroundColor = '';\r\n let tds = tableRows[i].getElementsByTagName( 'td' );\r\n for ( var j = 0; j < tds.length; j++ ) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n },\r\n });\r\n \r\n wptbTdBgColorSavedSet( 'wptb-table-header-bg', 0 );\r\n jQuery('#wptb-table-header-bg').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = ui.color.toString();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n },\r\n clear: function(){\r\n var tableHeader = table.getElementsByTagName('tr')[0];\r\n tableHeader.style.backgroundColor = '';\r\n let tds = tableHeader.getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n tds[j].style.backgroundColor = '';\r\n }\r\n \r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n });\r\n \r\n function tableAdaptiveForMobile( table ) {\r\n let wptbAdaptiveTableCheckbox = document.getElementById( 'wptb-adaptive-table-checkbox' );\r\n if( table && table.dataset.wptbAdaptiveTable && table.dataset.wptbAdaptiveTable == \"1\" ) {\r\n wptbAdaptiveTableCheckbox.checked = true;\r\n } else {\r\n wptbAdaptiveTableCheckbox.checked = false;\r\n }\r\n }\r\n tableAdaptiveForMobile( table );\r\n \r\n function tableTopRowAsHeadSavedSet( table ) {\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n if( table && table.classList.contains( 'wptb-table-preview-head' ) ) {\r\n wptbTopRowAsHeader.checked = true;\r\n } else {\r\n wptbTopRowAsHeader.checked = false;\r\n }\r\n }\r\n tableTopRowAsHeadSavedSet( table );\r\n \r\n function tableBorderColorWidthSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n if ( table.length > 0 ) {\r\n let tableBorderColor = table[0].style.borderColor;\r\n if ( tableBorderColor ) {\r\n let tableBorderColorInput = document.getElementById( 'wptb-table-border-color' );\r\n if ( tableBorderColorInput ) {\r\n tableBorderColorInput.value = WPTB_Helper.rgbToHex( tableBorderColor );\r\n }\r\n }\r\n \r\n let tableBorderWidth = table[0].style.borderWidth;\r\n if ( tableBorderWidth ) {\r\n let wptbTableBorderWidthSlider = document.getElementById('wptb-table-border-slider'),\r\n wptbTableBorderWidthNumber = document.getElementById('wptb-table-border-number');\r\n \r\n if ( wptbTableBorderWidthSlider ) {\r\n wptbTableBorderWidthSlider.value = parseInt( tableBorderWidth );\r\n }\r\n if ( wptbTableBorderWidthNumber ) {\r\n wptbTableBorderWidthNumber.value = parseInt( tableBorderWidth );\r\n }\r\n }\r\n \r\n \r\n let tableTd = table[0].querySelector( 'td' );\r\n let applyInnerBorder = tableTd.style.borderWidth;\r\n if ( applyInnerBorder ) {\r\n let innerBorderCheckInput = document.getElementById( 'wptb-inner-border-check' );\r\n let wptbApplyInnerBorder = document.getElementById( 'wptb-apply-inner-border' );\r\n if ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) {\r\n if ( innerBorderCheckInput ) {\r\n innerBorderCheckInput.checked = true;\r\n \r\n if ( wptbApplyInnerBorder ) {\r\n wptbApplyInnerBorder.classList.add( 'visible' );\r\n let wptbTableInnerBorderSlider = document.getElementById( 'wptb-table-inner-border-slider' );\r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n wptbTableInnerBorderSlider.value = parseInt( applyInnerBorder );\r\n wptbTableInnerBorderNumber.value = parseInt( applyInnerBorder );\r\n }\r\n }\r\n } else {\r\n innerBorderCheckInput.checked = false;\r\n }\r\n }\r\n \r\n if ( ( tableBorderWidth && parseInt( tableBorderWidth ) > 0 ) || ( applyInnerBorder && parseInt( applyInnerBorder ) > 0 ) ) {\r\n document.getElementById( 'wptb-table-border-color-set-area' ).style.display = '';\r\n }\r\n }\r\n }\r\n \r\n tableBorderColorWidthSavedSet();\r\n\r\n jQuery('#wptb-table-border-color').wpColorPicker({\r\n change: function (event, ui) {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.border = document.querySelector('#wptb-table-border-number').value + 'px solid ' + ui.color.toString();\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n let tableInnerborderNumber = document.querySelector('#wptb-table-inner-border-number').value;\r\n if ( document.getElementById('wptb-inner-border-check').checked ) {\r\n tableCells[i].style.border = ( tableInnerborderNumber != 0 ? tableInnerborderNumber : 1 ) + 'px solid ' + ui.color.toString();\r\n }\r\n }\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n },\r\n clear: function() {\r\n var tableCells = table.getElementsByTagName('td');\r\n table.style.borderColor = '';\r\n\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderColor = '';\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n\r\n function addInnerBorderSize(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.borderWidth = document.querySelector('#wptb-table-inner-border-number').value + 'px';\r\n tableCells[i].style.borderStyle = 'solid';\r\n }\r\n }\r\n\r\n function addCellPadding(value) {\r\n var tableCells = table.getElementsByTagName('td');\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.padding = value + 'px';\r\n }\r\n }\r\n\r\n function addInnerBorder( checked ) {\r\n var styles, color = document.querySelector('#wptb-table-border-color').value != undefined ?\r\n document.querySelector('#wptb-table-border-color').value : 'rgb(0,0,0)';\r\n if ( document.querySelector( '#wptb-table-inner-border-slider' ).value == 0 || document.querySelector( '#wptb-table-inner-border-number' ).value == 0 ) {\r\n document.querySelector( '#wptb-table-inner-border-slider' ).value = 1;\r\n document.querySelector( '#wptb-table-inner-border-number' ).value = 1;\r\n }\r\n let width = document.querySelector( '#wptb-table-inner-border-slider' ).value + 'px';\r\n let wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if( wptbPreviewTable.length > 0 ) {\r\n if (checked == 'checked') {\r\n document.getElementById('wptb-apply-inner-border').style.marginBottom = '0px';\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = width + ' solid ' + color;\r\n }\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.add( 'visible' );\r\n } else {\r\n document.getElementById( 'wptb-apply-inner-border' ).classList.remove( 'visible' );\r\n var tableCells = wptbPreviewTable[0].getElementsByTagName( 'td' );\r\n for (var i = 0; i < tableCells.length; i++) {\r\n tableCells[i].style.border = '0px solid ' + color;\r\n tableCells[i].style.border = null;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n function addBorderSize( value ) {\r\n table.style.borderWidth = value + 'px';\r\n table.style.borderStyle = 'solid';\r\n }\r\n \r\n function cellPaddingSavedSet() {\r\n let table = document.getElementsByClassName('wptb-preview-table');\r\n \r\n if ( table.length > 0 ) {\r\n let td = table[0].querySelector( 'td' );\r\n \r\n if ( td ) {\r\n let padding = td.style.padding;\r\n \r\n if ( padding ) {\r\n let wptbTableCellSlider = document.getElementById('wptb-table-cell-slider'),\r\n wptbTableCellNumber = document.getElementById('wptb-table-cell-number');\r\n \r\n if ( wptbTableCellSlider ) {\r\n wptbTableCellSlider.value = parseInt( padding );\r\n }\r\n if ( wptbTableCellNumber ) {\r\n wptbTableCellNumber.value = parseInt( padding );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n cellPaddingSavedSet();\r\n \r\n function numberImputSize( wptbNumberInputs, maxCount, maxValue ) {\r\n wptbNumberInputs.onkeydown = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue[0] == 0 ) {\r\n this.value = \"\";\r\n } else {\r\n thisValue = thisValue.substring( 0, maxCount );\r\n this.value = thisValue;\r\n }\r\n }\r\n wptbNumberInputs.onkeyup = function() {\r\n let thisValue = this.value;\r\n thisValue = String( thisValue );\r\n if ( thisValue > maxValue ) {\r\n this.value = maxValue;\r\n }\r\n }\r\n }\r\n \r\n let wptbTableBorderNumber = document.getElementById( 'wptb-table-border-number' );\r\n numberImputSize( wptbTableBorderNumber, 1, 50 );\r\n \r\n let wptbTableInnerBorderNumber = document.getElementById( 'wptb-table-inner-border-number' );\r\n numberImputSize( wptbTableInnerBorderNumber, 1, 50 );\r\n \r\n let wptbTableCellNumber = document.getElementById( 'wptb-table-cell-number' );\r\n numberImputSize( wptbTableCellNumber, 1, 50 );\r\n \r\n let wptbTextfontSizeNumber = document.getElementById( 'wptb-text-font-size-number' );\r\n numberImputSize( wptbTextfontSizeNumber, 1, 50 );\r\n \r\n let wptbImageWidthNumber = document.getElementById( 'wptb-image-width-number' );\r\n numberImputSize( wptbImageWidthNumber, 2, 100 );\r\n \r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n numberImputSize( wptbTableColumnWidthNumber, 2, 500 );\r\n \r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n numberImputSize( wptbTableRowHeightNumber, 2, 200 );\r\n \r\n \r\n \r\n document.getElementById('wptb-table-cell-slider').oninput = function () {\r\n document.getElementById('wptb-table-cell-number').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n \r\n document.getElementById('wptb-table-cell-slider').onchange = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n document.getElementById('wptb-table-cell-number').onchange = function () {\r\n document.getElementById('wptb-table-cell-slider').value = this.value;\r\n addCellPadding(this.value);\r\n table.tdDefaultWidth();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById('wptb-table-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-border-number').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n \r\n let wptbInnerBorderCheck = document.getElementById('wptb-inner-border-check').checked,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if ( this.value == 0 && wptbInnerBorderCheck == false ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n };\r\n \r\n document.getElementById('wptb-table-border-slider').onchange = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n document.getElementById('wptb-table-border-number').onchange = function () {\r\n document.getElementById('wptb-table-border-slider').value = this.value;\r\n addBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById('wptb-table-inner-border-slider').oninput = function () {\r\n document.getElementById('wptb-table-inner-border-number').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n };\r\n \r\n document.getElementById('wptb-table-inner-border-slider').onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n document.getElementById('wptb-table-inner-border-number').onchange = function () {\r\n document.getElementById('wptb-table-inner-border-slider').value = this.value;\r\n addInnerBorderSize(this.value);\r\n table.tdDefaultWidth();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById('wptb-inner-border-check').onchange = function () {\r\n if( table ) {\r\n let val = this.checked ? 'checked' : 'unchecked';\r\n addInnerBorder( val );\r\n let borderWidth = document.getElementById('wptb-table-border-slider').value,\r\n tableBorderColorSetArea = document.getElementById( 'wptb-table-border-color-set-area' );\r\n if( val == 'unchecked' && borderWidth == 0 ) {\r\n tableBorderColorSetArea.style.display = 'none';\r\n } else {\r\n tableBorderColorSetArea.style.display = '';\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-column-width-number' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-slider' ).onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = this.value;\r\n table.addColumnWidth( this.value );\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-table-column-width-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n table.addColumnWidth( width );\r\n } else {\r\n table.addColumnWidth( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let width = WPTB_Helper.getColumnWidth( table, highlighted );\r\n document.getElementById( 'wptb-table-column-width-number' ).value = width;\r\n document.getElementById( 'wptb-table-column-width-slider' ).value = width;\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-slider' ).oninput = function () {\r\n document.getElementById( 'wptb-table-row-height-number' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n };\r\n \r\n document.getElementById( 'wptb-table-row-height-slider' ).onchange = function () {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementById( 'wptb-table-row-height-number' ).onchange = function () {\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = this.value;\r\n table.addRowHeight( this.value );\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-table-row-height-auto-fixed' ).onchange = function () {\r\n if( this.checked ) {\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n table.addRowHeight( height );\r\n } else {\r\n table.addRowHeight( false, true );\r\n let highlighted = table.querySelector( '.wptb-highlighted' );\r\n let height = WPTB_Helper.getRowHeight( table, highlighted );\r\n document.getElementById( 'wptb-table-row-height-number' ).value = height;\r\n document.getElementById( 'wptb-table-row-height-slider' ).value = height;\r\n }\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n document.getElementById( 'wptb-adaptive-table-checkbox' ).onchange = function() {\r\n if( this.checked ) {\r\n table.dataset.wptbAdaptiveTable = 1;\r\n } else {\r\n table.dataset.wptbAdaptiveTable = 0;\r\n }\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n \r\n function createMobileHeadForTable( table, thisEvent ) {\r\n \r\n if( thisEvent.checked ) {\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n \r\n table.classList.add( 'wptb-table-preview-head' );\r\n table.rows[0].classList.add( 'wptb-table-head' );\r\n } else {\r\n let rows = table.rows;\r\n table.classList.remove( 'wptb-table-preview-head' );\r\n rows[0].classList.remove( 'wptb-table-head' );\r\n \r\n for ( let i = 1; i < rows.length; i++ ) {\r\n let thisRow = rows[i],\r\n thisRowChildren = thisRow.children;\r\n for( let j = 0; j < thisRowChildren.length; j++ ) {\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-font-size' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-column-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-background-color' );\r\n thisRowChildren[j].removeAttribute( 'data-wptb-title-align' );\r\n }\r\n }\r\n }\r\n }\r\n \r\n document.getElementById( 'wptb-top-row-as-header' ).onchange = function () {\r\n createMobileHeadForTable( table, this );\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n for (var i = 0; i < wptbElementButtons.length; i++) {\r\n wptbElementButtons[i].ondragstart = function (e) {\r\n e.dataTransfer.setData('wptbElement', this.dataset.wptbElement);\r\n e.dataTransfer.setData( 'wptbElIndic-' + this.dataset.wptbElement, 'wptbElIndic-' + this.dataset.wptbElement );\r\n }\r\n }\r\n \r\n if( table ) {\r\n document.getElementById('wptb-activate-cell-management-mode').onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-table-edit-mode-close' ).onclick = table.toggleTableEditMode;\r\n document.getElementById( 'wptb-left-scroll-panel-curtain-close' ).onclick = table.toggleTableEditMode;\r\n document.getElementById('wptb-add-end-row').onclick = table.addRowToTheEnd;\r\n document.getElementById('wptb-add-start-row').onclick = table.addRowToTheStart;\r\n document.getElementById('wptb-add-row-before').onclick = table.addRowBefore;\r\n document.getElementById('wptb-add-row-after').onclick = table.addRowAfter;\r\n document.getElementById('wptb-add-end-column').onclick = table.addColumnEnd;\r\n document.getElementById('wptb-add-start-column').onclick = table.addColumnStart;\r\n document.getElementById('wptb-add-column-before').onclick = table.addColumnBefore;\r\n document.getElementById('wptb-add-column-after').onclick = table.addColumnAfter;\r\n document.getElementById('wptb-delete-column').onclick = table.deleteColumn;\r\n document.getElementById('wptb-delete-row').onclick = table.deleteRow;\r\n document.getElementById('wptb-merge-cells').onclick = table.mergeCells;\r\n document.getElementById('wptb-split-cell').onclick = table.splitCell;\r\n }\r\n \r\n document.querySelector( '.wptb-left-panel-extend' ).onclick = function() {\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n if( wptbContainer ) {\r\n if ( wptbContainer.classList.contains( 'collapsed' ) ) {\r\n wptbContainer.classList.remove( 'collapsed' );\r\n } else {\r\n wptbContainer.classList.add( 'collapsed' );\r\n }\r\n }\r\n };\r\n \r\n // this code hides the \"element parameters\" area \r\n // when clicked outside this element and its \"tinymce\" toolbar \r\n let wptbBuilderPanel = document.getElementsByClassName( 'wptb-builder-panel' )[0];\r\n wptbBuilderPanel.onclick = function( e ) {\r\n if( ! e.target.classList.contains( 'wptb-ph-element' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-ph-element' ) && \r\n ! e.target.classList.contains( 'wptb-fixed-toolbar' ) && ! WPTB_Helper.findAncestor( e.target, 'wptb-fixed-toolbar' ) ) {\r\n clickOnFreeSpace();\r\n } \r\n };\r\n \r\n let wptbHeader = document.getElementsByClassName( 'wptb-header' );\r\n if( wptbHeader.length > 0 ) wptbHeader = wptbHeader[0];\r\n wptbHeader.onclick = function() {\r\n clickOnFreeSpace();\r\n }\r\n \r\n function clickOnFreeSpace() {\r\n document.getElementsByClassName( 'wptb-elements-container' )[0].style.display = 'table';\r\n document.getElementsByClassName( 'wptb-settings-section' )[0].style.display = 'block';\r\n document.getElementById( 'element-options-group' ).style.display = 'none';\r\n let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n if( wpcdFixedToolbar.hasAttribute( 'data-toolbar-active-id' ) ) {\r\n document.getElementById( wpcdFixedToolbar.getAttribute( 'data-toolbar-active-id' ) ).classList.remove( 'toolbar-active' );\r\n }\r\n }\r\n \r\n};","var WPTB_List = function ( innerElements, DOMElementProt ) {\r\n\r\n var el_L = document.createElement('ul'), item,\r\n DOMElement = document.createElement('div'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n DOMElement.classList.add( 'wptb-list-item-container' );\r\n\r\n this.kind = 'list';\r\n\r\n if (innerElements === '') {\r\n //Case for edit mode list\r\n } else if ( !innerElements ) {\r\n for (var i = 0; i < 3; i++) {\r\n item = new WPTB_ListItem( '<p>List Item ' + (i + 1) + '</p>');\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n } else {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n \r\n for ( var i = 0; i < innerElements.length; i++ ) {\r\n let listItem = DOMElementProt.querySelector( 'li' );\r\n item = new WPTB_ListItem( innerElements[i], listItem, true );\r\n el_L.appendChild(item.getDOMElement());\r\n }\r\n }\r\n DOMElement.appendChild(el_L);\r\n //window.addElementOptions('list', elList);\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n }\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n WPTB_Helper.listItemsRecalculateIndex( el_L );\r\n\r\n return this;\r\n};","var WPTB_ListItem = function ( text, DOMElementProt, copy ) {\r\n let wptbListItemReturn;\r\n if ( DOMElementProt == undefined || ( DOMElementProt && copy )) {\r\n if (text == undefined) text = 'New List Item';\r\n var DOMElement = document.createElement('li'),\r\n //divdot = document.createElement('div'),\r\n divcontent = document.createElement('div');\r\n //libullet = document.createElement('li');\r\n //divdot.classList.add('wptb-list-item-style-dot');\r\n divcontent.classList.add('wptb-list-item-content');\r\n //libullet.classList.add('wptb-bullet');\r\n if ( DOMElementProt ) {\r\n let styleDot = DOMElementProt.getAttribute( 'style' );\r\n if ( styleDot ) {\r\n DOMElement.setAttribute( 'style', styleDot );\r\n }\r\n }\r\n //DOMElement.appendChild(divdot);\r\n DOMElement.appendChild(divcontent);\r\n //divdot.appendChild(libullet);\r\n divcontent.innerHTML = text;\r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = true;\r\n } else {\r\n var DOMElement = DOMElementProt;\r\n var divcontent = DOMElement.getElementsByClassName( 'wptb-list-item-content' )[0];\r\n \r\n divcontent.onkeyup = window.listItemKeyListener;\r\n \r\n wptbListItemReturn = false;\r\n }\r\n \r\n DOMElement.onmouseenter = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 2, DOMElement );\r\n \r\n wptbActionsField.setParameters( DOMElement );\r\n console.log(DOMElement);\r\n };\r\n\r\n DOMElement.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.leaveFromField( event, DOMElement, 2 );\r\n \r\n return false;\r\n };\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n \r\n if ( wptbListItemReturn ) {\r\n return this;\r\n }\r\n};","var MultipleSelect = function () {\r\n\r\n\tvar selectedCells = [],\r\n\t\tmultipleCellMode = false;\r\n\r\n\tthis.activateMultipleSelectMode = function () {\r\n\t\tselectedCells = [];\r\n\t\tvar tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n\t\tfor (var i = 0; i < tds.length; i++) {\r\n\t\t\ttds[i].classList.remove('wptb-highlighted');\r\n\t\t}\r\n\t\tmultipleCellMode = true;\r\n\t}\r\n\r\n\tthis.deactivateMultipleSelectMode = function () {\r\n\t\tmultipleCellMode = false;\r\n\t}\r\n\r\n\tthis.isActivated = function () {\r\n\t\treturn multipleCellMode;\r\n\t}\r\n\r\n\tthis.pushSelectedCell = function (cell) {\r\n\t\tif (!multipleCellMode) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tselectedCells.push(cell);\r\n\t\tcell.classList.add('wptb-highlighted');\r\n\t};\r\n\r\n\tthis.selectedCells = function () {\r\n\t\treturn selectedCells;\r\n\t}\r\n\r\n\tthis.flushSelectedCells = function () {\r\n\t\tselectedCells = [];\r\n\t}\r\n\r\n\tthis.getFirst = function () {\r\n\t\tvar minXIndex = 1000, minYIndex = 1000, first;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (minXIndex >= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& minYIndex >= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tfirst = selectedCells[i];\r\n\t\t\t\tminXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tminYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn first;\r\n\t}\r\n\r\n\tthis.getLast = function () {\r\n\t\tvar maxXIndex = -1, maxYIndex = -1, last;\r\n\t\tfor (var i = selectedCells.length - 1; i >= 0; i--) {\r\n\t\t\tif (maxXIndex <= selectedCells[i].dataset.xIndex\r\n\t\t\t\t&& maxYIndex <= selectedCells[i].dataset.yIndex) {\r\n\t\t\t\tlast = selectedCells[i];\r\n\t\t\t\tmaxXIndex = selectedCells[i].dataset.xIndex;\r\n\t\t\t\tmaxYIndex = selectedCells[i].dataset.yIndex;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn last;\r\n\t}\r\n\r\n\tthis.removeAllButFirst = function () {\r\n\t\tvar td = this.getFirst();\r\n\t\tfor (var i = 1; i < selectedCells.length; i++) {\r\n\t\t\tselectedCells[i].classList.add('wptb-fused-cell-' + td.dataset.xIndex + '-' + td.dataset.yIndex);\r\n\t\t}\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_Parser = function (code) {\n let div = document.createElement( 'div' );\n div.innerHTML = code;\n \n let table = div.children[0];\n let columnTitleMobile = [...table.querySelectorAll( '.wptb-column-title-mobile-container' )];\n \n for( let i = 0; i < columnTitleMobile.length; i++ ) {\n let parent = columnTitleMobile[i].parentNode;\n parent.removeChild( columnTitleMobile[i] );\n }\n \n let tds = table.querySelectorAll( 'td' );\n for ( let i = 0; i < tds.length; i++ ) {\n tds[i].classList.add( 'wptb-droppable' );\n tds[i].classList.remove( 'wptb-column-title-mobile-not-elements' );\n }\n \n return table;\n}","var WPTB_Parser2 = function (code) {\r\n if( Array.isArray( code ) ) {\r\n let elementHtml;\r\n \r\n if ( code.length == 1) {\r\n return elementHtml.appendChild( document.createTextNode( code[0] ) );\r\n }\r\n if( 0 in code ) {\r\n let tagName = code[0];\r\n elementHtml = document.createElement( tagName );\r\n \r\n if ( 1 in code ) {\r\n if( Array.isArray( code[1] ) ) {\r\n let attributes = code[1];\r\n \r\n for( let i = 0; i < attributes.length; i++ ) {\r\n if( Array.isArray( attributes[i] ) ) {\r\n elementHtml.setAttribute(attributes[i][0], attributes[i][1]);\r\n }\r\n }\r\n }\r\n }\r\n \r\n if ( 2 in code ) {\r\n if ( Array.isArray( code[2] ) ) {\r\n for ( let i = 0; i < code[2].length; i++ ) {\r\n if ( typeof code[2][i] === 'string' && tagName.toLowerCase() == 'p' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2][i] ) );\r\n continue;\r\n }\r\n if ( ! WPTB_Parser( code[2][i] ) ) continue;\r\n elementHtml.appendChild( WPTB_Parser( code[2][i] ) );\r\n }\r\n } else if( typeof code[2] === 'string' ) {\r\n elementHtml.appendChild( document.createTextNode( code[2] ) );\r\n }\r\n \r\n }\r\n }\r\n \r\n return elementHtml;\r\n } else {\r\n return false;\r\n }\r\n \r\n}","var WPTB_Settings = function () {\r\n var elems = document.getElementsByClassName('wptb-element');\r\n\r\n for ( var i = 0; i < elems.length; i++ ) {\r\n elems[i].ondragstart = function ( event ) {\r\n event.dataTransfer.effectAllowed = 'move';\r\n event.dataTransfer.setData( 'wptbElement', event.target.dataset.wptbElement );\r\n event.dataTransfer.setData( 'wptbElIndic-' + event.target.dataset.wptbElement, 'wptbElIndic-' + event.target.dataset.wptbElement );\r\n }\r\n elems[i].ondragend = function () {\r\n let wptbDropHandle = document.querySelector( '.wptb-drop-handle' ),\r\n wptbDropBorderMarker = document.querySelector( '.wptb-drop-border-marker' );\r\n if ( wptbDropHandle || wptbDropBorderMarker ) {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n }\r\n };\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\r\n if( wptbUndo.length > 0 ) {\r\n wptbUndo = wptbUndo[0];\r\n \r\n wptbUndo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if( wptbUndoRedoContainer.length > 0 ) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\r\n if( wptbRedo.length > 0 ) {\r\n wptbRedo = wptbRedo[0];\r\n \r\n wptbRedo.onclick = function( event ) {\r\n if( ! this.classList.contains( 'wptb-undoredo-disabled' ) ) {\r\n wptbTableStateSaveManager.tableStateGet( this.dataset.wptbUndoredo );\r\n let wptbUndoRedoContainer = document.getElementsByClassName( 'wptb-undo-redo-container' );\r\n if( wptbUndoRedoContainer.length > 0 ) {\r\n wptbUndoRedoContainer = wptbUndoRedoContainer[0];\r\n wptbUndoRedoContainer.onmouseleave = function( event ) {\r\n event.target.onmouseleave = '';\r\n WPTB_Table();\r\n }\r\n }\r\n }\r\n \r\n }\r\n }\r\n \r\n let shortcodePopupWindow = document.getElementsByClassName( 'wptb-popup-window-modal' )[0];\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].onclick = function () {\r\n if( ! this.classList.contains( 'wptb-button-disable' ) ) {\r\n shortcodePopupWindow.classList.add( 'wptb-popup-show' );\r\n }\r\n }\r\n \r\n window.onbeforeunload = function(e) {\r\n let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );\r\n if( wptbSaveDisabled.length == 0 ) {\r\n return true;\r\n } else {\r\n return null;\r\n }\r\n };\r\n \r\n \r\n document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( e ) {\r\n if( this.classList.contains( 'wptb-button-disable' ) ) {\r\n e.preventDefault();\r\n }\r\n }\r\n\r\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {\r\n if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \r\n window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {\r\n return;\r\n }\r\n let bar = document.querySelector( '.wptb-edit-bar' );\r\n if ( bar && bar.classList.contains( 'visible' ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\r\n table.toggleTableEditMode();\r\n }\r\n\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\r\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\r\n messagingArea,\r\n code = document.getElementsByClassName( 'wptb-preview-table' );\r\n if( code.length > 0 ) {\r\n code = WPTB_Stringifier( code[0] );\r\n code = code.outerHTML;\r\n } else { \r\n code = '';\r\n }\r\n \r\n if ( t === '' || code === '' ) {\r\n let messagingAreaText = '';\r\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\r\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\r\n messagingArea.classList.add( 'wptb-warning' );\r\n setTimeout(function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n return;\r\n }\r\n\r\n let params = {\r\n title: t,\r\n content: code,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\r\n params.id = rs;\r\n }\r\n params = JSON.stringify( params );\r\n\r\n http.open('POST', url, true);\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function (action) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n\r\n if ( data[0] == 'saved' ) {\r\n document.wptbId = data[1];\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\r\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\r\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\r\n if( wptbPreviewBtn.length > 0 ) {\r\n wptbPreviewBtn = wptbPreviewBtn[0];\r\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\r\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\r\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\r\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\r\n }\r\n \r\n } else if( data[0] == 'edited' ) {\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\r\n event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;\r\n \r\n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\r\n if( wptbSaveBtn.length > 0 ) {\r\n wptbSaveBtn = wptbSaveBtn[0];\r\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\r\n }\r\n } else {\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\r\n }\r\n messagingArea.classList.add( 'wptb-success' );\r\n setTimeout( function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n }\r\n }\r\n http.send( params );\r\n }\r\n};\r\n","var WPTB_Space = function ( elSpaceBetween ) {\r\n\r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n let spaceBetween;\r\n if ( ! elSpaceBetween ) {\r\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\r\n } else {\r\n spaceBetween = elSpaceBetween;\r\n }\r\n\r\n spaceBetween.ondragenter = function () {\r\n this.classList.add('visible');\r\n };\r\n spaceBetween.ondragover = function (event) {\r\n event.preventDefault();\r\n };\r\n\r\n spaceBetween.ondragleave = function () {\r\n this.classList.remove('visible');\r\n };\r\n\r\n spaceBetween.ondrop = function (event) {\r\n event.stopPropagation();\r\n\r\n var p = event.target.nextSibling,\r\n td = event.target,\r\n element, t_space, spaceParent;\r\n\r\n while ( !td.classList.contains('wptb-droppable') ) {\r\n td = td.parentNode;\r\n }\r\n\r\n if (event.dataTransfer.getData('wptbElement')) {\r\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\r\n this.classList.remove('visible');\r\n\r\n if (p == null) {\r\n td.appendChild(element.getDOMElement());\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element.getDOMElement(), p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n } else {\r\n alert(event.dataTransfer.getData('node'));\r\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\r\n t_space = element.nextSibling;\r\n spaceParent = element.parentNode;\r\n if (t_space != undefined) {\r\n spaceParent.removeChild(t_space);\r\n }\r\n\r\n if (p == null) {\r\n td.appendChild(element);\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element, p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n }\r\n this.classList.remove('visible');\r\n };\r\n \r\n if ( ! elSpaceBetween ) {\r\n return spaceBetween;\r\n }\r\n};","var WPTB_Stringifier = function ( codeMain ) {\r\n if ( codeMain ) {\r\n let code = codeMain.cloneNode( true );\r\n code.classList.add( 'wptb-table-preview-static-indic' );\r\n code.dataset.tableColumns = codeMain.columns;\r\n code.style.width = null;\r\n code.style.minWidth = null;\r\n code.style.maxWidth = null;\r\n \r\n let tds = code.getElementsByTagName( 'td' );\r\n if ( tds.length > 0 ) {\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n \r\n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\r\n tds[i].removeAttribute( 'data-x-index' );\r\n }\r\n tds[i].removeAttribute( 'data-y-index' );\r\n tds[i].removeAttribute( 'draggable' );\r\n tds[i].classList.remove( 'wptb-droppable' );\r\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( innerElements.length > 0 ) {\r\n for ( let j = 0; j < innerElements.length; j++ ) {\r\n \r\n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n \r\n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n \r\n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n \r\n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n \r\n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n \r\n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\r\n let wptbActionsLength = wptbActions.length;\r\n while ( wptbActionsLength > 0 ) {\r\n if( wptbActions[0] && wptbActions[0].parentNode ) {\r\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\r\n wptbActionsLength--;\r\n } else {\r\n break;\r\n }\r\n \r\n } \r\n }\r\n }\r\n \r\n if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\r\n let columnNameDivContainer = document.createElement( 'div' ),\r\n columnNameDiv = document.createElement( 'div' );\r\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\r\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\r\n columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\r\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\r\n color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\r\n columnNameDiv.style.padding = tds[i].style.padding;\r\n if( tds[i].children.length == 0 ) {\r\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\r\n }\r\n columnNameDivContainer.appendChild( columnNameDiv );\r\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\r\n }\r\n }\r\n }\r\n \r\n return code;\r\n }\r\n}","var WPTB_Stringifier2 = function ( node, start = false ) {\r\n\r\n\tif ( node == undefined ) {\r\n\t\treturn '';\r\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\r\n return node.nodeValue;\r\n }\r\n \r\n let code = [],\r\n children,\r\n int_elem_arr = false,\r\n attributes = [...node.attributes],\r\n attributes_list = [],\r\n internal_elements = [];\r\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \r\n node.parentNode.classList.contains( 'mce-content-body' ) ) && \r\n node.tagName.toLowerCase() == 'p' ) {\r\n children = node.childNodes;\r\n int_elem_arr = true;\r\n } else if( node.children.length > 0 ) {\r\n children = node.children;\r\n } else {\r\n children = node.childNodes;\r\n }\r\n if ( attributes.length > 0 ) {\r\n for ( let i = 0; i < attributes.length; i++ ) {\r\n attributes_list[i] = [attributes[i].name, attributes[i].value];\r\n }\r\n } else {\r\n attributes_list = '';\r\n }\r\n \r\n if ( children.length > 0 ) {\r\n for ( let i = 0; i < children.length; i++) {\r\n let inter_elem = WPTB_Stringifier(children[i]);\r\n \r\n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\r\n internal_elements[i] = inter_elem;\r\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\r\n internal_elements = inter_elem;\r\n }\r\n }\r\n } else {\r\n internal_elements = '';\r\n }\r\n \r\n \r\n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\r\n \r\n return code;\r\n}","var array = [], WPTB_Table = function (columns, rows) {\r\n\r\n /* The members of the class */\r\n var settings = document.getElementsByClassName('wptb-settings-items'),\r\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\r\n table, row, cell,\r\n maxAmountOfCells,\r\n maxAmountOfRows;\r\n\r\n //HERE ARE THE PRIVATE FUNCTIONS\r\n /*\r\n * This function toggles buttons visibility in cell edit mode\r\n * (according to the amount of currently selected cells), and\r\n * highlights visually the clicked cell if it is not highlighted, or\r\n * removes highlight if clicked cell is already highlighted. \r\n * It too toggles the bits of our abstract representation.\r\n * @param Event this is the event instance of the click performed over a cell.\r\n */\r\n var mark = function ( event ) {\r\n var rs = this.rowSpan,\r\n cs = this.colSpan,\r\n markedCells,\r\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n position = getCoords(this),\r\n row = position[0],\r\n column = position[1];\r\n if ( ! document.select.isActivated() ) {\r\n return;\r\n }\r\n if (this.className.match(/wptb-highlighted/)) {\r\n this.classList.remove('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 0;\r\n }\r\n }\r\n } else {\r\n this.classList.add('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 1;\r\n }\r\n }\r\n }\r\n\r\n markedCells = document.getElementsByClassName('wptb-highlighted').length;\r\n if (markedCells === 0) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n } else if (markedCells === 1) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.add('visible');\r\n singleCells[i].removeAttribute('disabled');\r\n }\r\n let cellHighlighted = document.querySelector( '.wptb-highlighted' );\r\n if( cellHighlighted ) {\r\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n let width = cellHighlighted.style.width;\r\n if( width ) {\r\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\r\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\r\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\r\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\r\n wptbTableColumnWidthSlider.value = cellWidth;\r\n wptbTableColumnWidthNumber.value = cellWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = false;\r\n }\r\n \r\n \r\n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n let height = cellHighlighted.style.height;\r\n if( height ) {\r\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\r\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\r\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\r\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\r\n wptbTableRowHeightSlider.value = cellHeight;\r\n wptbTableRowHeightNumber.value = cellHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = false;\r\n }\r\n }\r\n cellSettings.classList.add( 'visible' );\r\n } else {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n if (table.isSquare(array)) {\r\n multipleCells[i].classList.add('visible');\r\n multipleCells[i].removeAttribute('disabled');\r\n } else {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n }\r\n };\r\n\r\n /* \r\n * This function fills an array with 1's according to the actual design\r\n * of HTML table.\r\n * @returns an array of arrays containing an abstract representation\r\n * of HTML table.\r\n * @deprecated\r\n * */\r\n\r\n var realTimeArray = function () {\r\n var carried = [], tds, cols, matriz = [];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n cols = [];\r\n\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n\r\n for (items = 0; items < tds.length; items++) {\r\n\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n cols.push(1);\r\n }\r\n\r\n if (tds[items].rowSpan > 1) {\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n carried[items + k] = {\r\n justAssigned: true,\r\n amount: tds[items].rowSpan\r\n };\r\n }\r\n }\r\n }\r\n\r\n for (var k = 0; k < maxAmountOfCells; k++) {\r\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\r\n carried[k].amount--;\r\n if (carried[k].justAssigned) {\r\n carried[k].justAssigned = false;\r\n } else {\r\n cols.push(1);\r\n }\r\n }\r\n }\r\n\r\n matriz.push(cols);\r\n\r\n }\r\n return matriz;\r\n };\r\n\r\n /*\r\n * This function gets the number and position of cell spaces in current row that are occuped \r\n * by upper rowspanned cells.\r\n * @param number the number of row where we wish to calculate the carried rowspans up to.\r\n * @return an array with the remaining rowspans in each column.\r\n */\r\n var carriedRowspans = function (row) {\r\n var carried = [], tds, cols;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n if (row == -1) {\r\n return carried;\r\n }\r\n\r\n for (var i = 0; i <= row; i++) {\r\n cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (carried[xPosition]) {\r\n carried[xPosition]--;\r\n } else {\r\n celda = cellsBuffer[cellPointer++];\r\n if (celda.rowSpan > 1) {\r\n for (k = 0; k < celda.colSpan; k++) {\r\n carried[xPosition + k] = celda.rowSpan - 1;\r\n }\r\n stepsToMove = celda.colSpan;\r\n } else if (celda.colSpan > 1) {\r\n stepsToMove = celda.colSpan;\r\n }\r\n }\r\n }\r\n\r\n }\r\n return carried;\r\n };\r\n\r\n /*\r\n * A helpful function for showing\r\n * the abstract table in console.\r\n * @param Array our abstract table.\r\n */\r\n var drawTable = function (a) {\r\n var string = 'DRAWING TABLE:\\n';\r\n for (var i = 0; i < a.length; i++) {\r\n\r\n for (var j = 0; j < a[i].length; j++) {\r\n string += ' ' + a[i][j];\r\n }\r\n string += '\\n';\r\n }\r\n table.isSquare(a);\r\n };\r\n\r\n /*\r\n * It resets all the bits of our abstract representation\r\n * to 0 and removes the highlighting class of all cells.\r\n */\r\n\r\n var undoSelect = function () {\r\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n tds = table.getElementsByClassName('wptb-highlighted');\r\n while (tds.length) {\r\n tds[0].classList.remove('wptb-highlighted');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n for (var i = 0; i < array.length; i++) {\r\n for (var j = 0; j < array[i].length; j++) {\r\n array[i][j] = 0;\r\n }\r\n }\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n };\r\n\r\n /*\r\n * This fills the abstract representation of our table with \r\n * zeros, at the start. the max amount of cells is the greatest sum\r\n * of all colspans for row.\r\n */\r\n\r\n var fillTableArray = function () {\r\n var colspansSums = [], a = [];\r\n\r\n //calculate max amount of cells inside a row\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cells = table.rows[i].getElementsByTagName('td'),\r\n colspanSumInRow = 0;\r\n for (var j = 0; j < cells.length; j++) {\r\n colspanSumInRow += cells[j].colSpan;\r\n }\r\n colspansSums.push(colspanSumInRow);\r\n }\r\n\r\n maxAmountOfCells = Math.max.apply(null, colspansSums);\r\n //calculate max rows\r\n var maxAmountOfRows = table.rows.length;\r\n\r\n // fill with zeros from both values\r\n for (var i = 0; i < maxAmountOfRows; i++) {\r\n a[i] = [];\r\n for (var j = 0; j < maxAmountOfCells; j++) {\r\n a[i].push(0);\r\n }\r\n }\r\n drawTable(a);\r\n return a;\r\n };\r\n\r\n /*\r\n * This function gets the sum of all colspans in a row.\r\n * @param number the number of row to be used as reference.\r\n */\r\n var getActualPointsInRow = function (row) {\r\n var tds = table.rows[row].getElementsByTagName('td'),\r\n points = 0;\r\n for (var i = 0; i < tds.length; i++) {\r\n points += tds[i].colSpan;\r\n }\r\n return points;\r\n }\r\n\r\n /*\r\n * This function gets us the exact coordinates of\r\n * an exact cell, in a more reliable way than xIndex and yIndex,\r\n * these last ones were meant to be used for getting the cell trough them.\r\n * @param DOMElement the cell to get the coordinates.\r\n */\r\n var getCoords = function (search) {\r\n var skipInCols = [], cell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n skipInCols[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (skipInCols[xPosition]) {\r\n skipInCols[xPosition]--;\r\n } else {\r\n var td = cellsBuffer[cellPointer++];\r\n if (td == search) {\r\n return [i, xPosition];\r\n }\r\n if (td.rowSpan > 1) {\r\n for ( let k = 0; k < td.colSpan; k++ ) {\r\n skipInCols[xPosition + k] = td.rowSpan - 1;\r\n }\r\n stepsToMove = td.colSpan;\r\n } else if (td.colSpan > 1) {\r\n stepsToMove = td.colSpan;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n jQuery('#wptb-table-header-bg').val('');\r\n jQuery('#wptb-even-row-bg').val('');\r\n jQuery('#wptb-odd-row-bg').val('');\r\n jQuery('#wptb-table-border-color').val('');\r\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\r\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\r\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\r\n\r\n if (columns || rows) {\r\n //END OF PRIVATE FUNCTIONS\r\n for (var i = 0; i < settings.length; i++) {\r\n if (settings[i].id !== 'wptb-apply-inner-border') {\r\n settings[i].classList.add('visible');\r\n }\r\n }\r\n\r\n //Create a HTML Table element.\r\n table = document.createElement( 'table' );\r\n table.classList.add( 'wptb-preview-table' );\r\n table.dataset.reconstraction = 1;\r\n table.dataset.wptbAdaptiveTable = 1;\r\n //Add the data rows.\r\n for (var i = 0; i < rows; i++) {\r\n\r\n row = table.insertRow(-1);\r\n row.classList.add( 'wptb-row' );\r\n\r\n for (var j = 0; j < columns; j++) {\r\n cell = new WPTB_Cell(mark);\r\n cell.setCoords(i, j);\r\n row.appendChild(cell.getDOMElement());\r\n }\r\n }\r\n } else {\r\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n if (wptb_preview_table.length > 0) {\r\n table = wptb_preview_table[0];\r\n\r\n let cells = table.getElementsByTagName('td');\r\n\r\n if (cells.length > 0) {\r\n for (let i = 0; i < cells.length; i++) {\r\n WPTB_Cell(mark, cells[i]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * This just toggles visibility of cell edit bar, and toggles \r\n * cell selecting mode.\r\n */\r\n\r\n table.toggleTableEditMode = function () {\r\n let bar = document.getElementsByClassName('wptb-edit-bar'),\r\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\r\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\r\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if (wptbPreviewTable.length > 0) {\r\n wptbPreviewTable = wptbPreviewTable[0];\r\n }\r\n\r\n if ( bar.length > 0 ) {\r\n for ( let i = 0; i < bar.length; i++ ) {\r\n if ( bar[i].classList.contains( 'visible' ) ) {\r\n document.select.deactivateMultipleSelectMode();\r\n bar[i].classList.remove( 'visible' );\r\n cellModeBackground.classList.remove( 'visible' );\r\n leftScrollPanelCurtain.classList.remove( 'visible' );\r\n leftScrollPanelCellSettings.classList.remove( 'visible' );\r\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\r\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\r\n if ( wptbPreviewTableTds.length > 0 ) {\r\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\r\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n }\r\n } else {\r\n document.select.activateMultipleSelectMode();\r\n bar[i].classList.add( 'visible' );\r\n cellModeBackground.classList.add( 'visible' );\r\n leftScrollPanelCurtain.classList.add( 'visible' );\r\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table. \r\n */\r\n\r\n table.recalculateIndexes = function ( start ) {\r\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\r\n tdsArr = [];\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n for (var i = 0; i < trs.length; i++) {\r\n if ( i == 0 ) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\r\n }\r\n if( wptbTopRowAsHeader.checked ) {\r\n if( start == undefined ) {\r\n this.classList.add( 'wptb-table-preview-head' ); \r\n trs[i].classList.add( 'wptb-table-head' )\r\n } ;\r\n } else {\r\n if( start == undefined ) {\r\n this.classList.remove( 'wptb-table-preview-head' );\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n } else {\r\n if (i % 2 == 0) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n } else {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n\r\n tdsArr[i];\r\n tds = trs[i].getElementsByTagName('td');\r\n\r\n if (tdsArr[i] == undefined) {\r\n tdsArr[i] = [];\r\n }\r\n\r\n let jMainIter = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tdsArr[i][j] != undefined) {\r\n for (let y = 0; y < 100; y++) {\r\n if (tdsArr[i][jMainIter] != undefined) {\r\n jMainIter++;\r\n continue;\r\n }\r\n tdsArr[i][jMainIter] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n break;\r\n }\r\n } else {\r\n tdsArr[i][j] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n }\r\n tds[j].dataset.yIndex = i;\r\n\r\n if (tds[j].colSpan > 1) {\r\n for (let k = 1; k < tds[j].colSpan; k++) {\r\n jMainIter++;\r\n tdsArr[i][jMainIter] = 'tdDummy';\r\n }\r\n }\r\n\r\n if (tds[j].rowSpan > 1) {\r\n for (let x = 1; x < tds[j].rowSpan; x++) {\r\n if (tdsArr[i + x] == undefined) {\r\n tdsArr[i + x] = [];\r\n }\r\n for (let z = 0; z < tds[j].colSpan; z++) {\r\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\r\n }\r\n }\r\n }\r\n jMainIter++;\r\n if( i == 0 ) {\r\n maxColsFull = jMainIter;\r\n }\r\n }\r\n if (j > maxCols) {\r\n maxCols = j;\r\n }\r\n }\r\n this.columns = maxCols;\r\n this.maxCols = maxColsFull;\r\n }\r\n \r\n table.addColumnWidth = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataXIndex = highlighted[k].dataset.xIndex;\r\n if( dataXIndex ) {\r\n function tableTdsFor( dataXIndex, colspan ) {\r\n let tableRows = table.rows;\r\n let widthIsSet = false;\r\n let arrayTdsFromPreviousRow = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.xIndex == dataXIndex ) {\r\n if( value ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n widthIsSet = true;\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n }\r\n } else {\r\n td.style.width = null;\r\n td.dataset.wptbFixedWidth = value;\r\n if( i == tableRows.length - 1 && ! widthIsSet ) {\r\n tableTdsFor( dataXIndex, colspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.width = null;\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } else {\r\n if( td.dataset.wptbFixedWidth ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = td.dataset.wptbFixedWidth + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } \r\n } else if( td.style.width ) {\r\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\r\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\r\n }\r\n arrayTdsFromPreviousRow = [];\r\n } else {\r\n arrayTdsFromPreviousRow.push( td );\r\n }\r\n }\r\n break;\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataXIndex, 1 );\r\n }\r\n }\r\n \r\n table.tdDefaultWidth();\r\n }\r\n }\r\n \r\n table.tdDefaultWidth = function() {\r\n let rows = table.rows;\r\n \r\n let tableTdsSumMaxWidth = 0;\r\n let tableTdsSumMaxWidthFixed = 0;\r\n let tableTdsSumMaxWidthAuto = 0;\r\n \r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n \r\n let arrayCellsWidthFixedHelper = [];\r\n let arrayCellsWidthAutoHelper = [];\r\n let tdPaddingCommon = 0;\r\n let tableTdBorderCommonWidth = 0;\r\n let cssForTdsWidthAuto = '';\r\n \r\n for( let i = 0; i < rows.length; i++ ) {\r\n let tds = rows[i].children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n \r\n if( ! arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( td.style.width ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] = parseFloat( td.style.width );\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n } else {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] = 100;\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n }\r\n \r\n if( window.getComputedStyle( td, null ) ) {\r\n let tdStyleObj = window.getComputedStyle( td, null );\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\r\n\r\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\r\n if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n } else {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n }\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n } else if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n }\r\n }\r\n }\r\n \r\n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\r\n if( arrayCellsWidthFixedHelper[i] ) {\r\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\r\n }\r\n }\r\n \r\n let CellsWidthAutoCount = 0;\r\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\r\n if( arrayCellsWidthAutoHelper[i] ) {\r\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\r\n CellsWidthAutoCount++;\r\n }\r\n }\r\n \r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\r\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\r\n \r\n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\r\n if( CellsWidthAutoCount ) {\r\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\r\n if( table.mergingСellsHorizontally ) {\r\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n }\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\r\n }\r\n \r\n let styleElementCreate = false;\r\n let tableTdWidthAuto;\r\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\r\n if( CellsWidthAutoCount ) {\r\n table.style.minWidth = '100%';\r\n if( table.mergingСellsHorizontally ) {\r\n table.style.width = null;\r\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\r\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\r\n styleElementCreate = true;\r\n } else {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.width = null;\r\n table.style.minWidth = null;\r\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\r\n }\r\n } else {\r\n table.style.maxWidth = null;\r\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\r\n table.style.width = null;\r\n tableTdWidthAuto = '100'\r\n styleElementCreate = true;\r\n }\r\n \r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAutoOld ) {\r\n head.removeChild( cssForTdsWidthAutoOld );\r\n }\r\n }\r\n \r\n if( styleElementCreate ) {\r\n cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\r\n if( head ) {\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n }\r\n \r\n table.addRowHeight = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataYIndex = highlighted[k].dataset.yIndex;\r\n if( dataYIndex ) {\r\n function tableTdsFor( dataYIndex, rowspan ) {\r\n let tableRows = table.rows;\r\n let heightIsSet = false;\r\n let arrayTdsPrevious = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.yIndex == dataYIndex ) {\r\n if( value ) {\r\n if( td.rowSpan == rowspan ) {\r\n td.style.height = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n heightIsSet = true;\r\n let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\r\n tableColumnHeightAutoFixedCheckbox.checked = true;\r\n }\r\n continue;\r\n } else {\r\n td.style.height = null;\r\n td.dataset.wptbFixedHeight = value;\r\n if( j == tds.length - 1 && ! heightIsSet ) {\r\n tableTdsFor( dataYIndex , rowspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.height = null;\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n } else {\r\n if( td.dataset.wptbFixedHeight ) {\r\n if( td.rowSpan = rowspan ) {\r\n td.style.height = td.dataset.wptbFixedHeight + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n }\r\n } else if( td.style.height ) {\r\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\r\n arrayTdsPrevious[z].style.height = td.style.height;\r\n }\r\n arrayTdsPrevious = [];\r\n } else {\r\n arrayTdsPrevious.push( td );\r\n }\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataYIndex, 1 );\r\n }\r\n }\r\n }\r\n }\r\n \r\n table.reconstraction = function() {\r\n let tds = table.getElementsByTagName( 'td' );\r\n let wptbAdaptiveTableChoseBlock = document.getElementsByClassName( 'wptb-adaptive-table-chose-block' );\r\n if( wptbAdaptiveTableChoseBlock.length > 0 ) {\r\n wptbAdaptiveTableChoseBlock = wptbAdaptiveTableChoseBlock[0];\r\n }\r\n table.mergingСellsHorizontally = false;\r\n table.mergingCellsVertically = false;\r\n table.dataset.reconstraction = 1;\r\n wptbAdaptiveTableChoseBlock.style.display = 'block';\r\n let forBreak = 0;\r\n for( let i = 0; i < tds.length; i++ ) {\r\n if( tds[i].colSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingСellsHorizontally = true;\r\n forBreak++;\r\n }\r\n \r\n if( tds[i].rowSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingCellsVertically = true;\r\n forBreak++;\r\n }\r\n \r\n if( forBreak == 2 ) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * As simple as it is: adds a column to the end of table.\r\n */\r\n table.addColumnEnd = function () {\r\n let td,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n \r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n \r\n table.rows[i].appendChild(td.getDOMElement());\r\n array[i].push(0);\r\n }\r\n \r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * As simple as it looks: adds a column to the start of table.\r\n */\r\n\r\n table.addColumnStart = function () {\r\n let td,\r\n firstCell,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if ( currentTable.length > 0 ) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if ( currentTableTd ) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n firstCell = table.rows[i].getElementsByTagName('td')[0];\r\n if (firstCell) {\r\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\r\n } else {\r\n table.rows[i].appendChild(td.getDOMElement());\r\n }\r\n array[i].push(0);\r\n }\r\n\r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Well, not so simple as previous functions.\r\n * It adds a column after a certain column of reference.\r\n * @param integer the column number to be used as reference.\r\n *\tIf empty, then the first highlighted cell is used as reference.\r\n */\r\n\r\n table.addColumnAfter = function (c_pos) {\r\n let rows = table.rows,\r\n cellPointer,\r\n cellsBuffer,\r\n cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\r\n \r\n \r\n \r\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\r\n table.addColumnEnd();\r\n } else {\r\n let pendingInsertion = false,\r\n stepsToMove,\r\n td, bro,\r\n carriedRowspans = [],\r\n currentCell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carriedRowspans.push(0);\r\n }\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n cellPointer = 0;\r\n cellsBuffer = rows[i].getElementsByTagName('td');\r\n pendingInsertion = false;\r\n for (var xPosition = 0;\r\n xPosition < maxAmountOfCells;\r\n xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (pendingInsertion) {\r\n td = new WPTB_Cell(mark);\r\n if (cellStyle) {\r\n td.getDOMElement().setAttribute('style', cellStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n if (currentCell && rows[i].contains(currentCell)) {\r\n bro = currentCell.nextSibling;\r\n if (bro) {\r\n rows[i].insertBefore(td.getDOMElement(), bro);\r\n } else {\r\n rows[i].appendChild(td.getDOMElement());\r\n }\r\n } else {\r\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\r\n }\r\n break;\r\n } else if (carriedRowspans[xPosition] > 0) {\r\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\r\n if (pos == xPosition) {\r\n pendingInsertion = true;\r\n }\r\n } else {\r\n currentCell = cellsBuffer[cellPointer++];\r\n if (currentCell.rowSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (currentCell.colSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (xPosition == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n }\r\n\r\n for (var l = 0; l < maxAmountOfCells; l++) {\r\n if (carriedRowspans[l] > 0)\r\n carriedRowspans[l]--;\r\n }\r\n\r\n }\r\n\r\n for (var i = 0; i < array.length; i++) {\r\n array[i].push(0);\r\n }\r\n maxAmountOfCells++;\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /*\r\n * For preventing us to take a lot of time,\r\n * This is just calling the function addColumnAfter, but\r\n * using the previous column to current one as reference.\r\n * @see addColumnAfter\r\n */\r\n\r\n table.addColumnBefore = function () {\r\n var cell = document.querySelector('.wptb-highlighted'),\r\n pos = getCoords(cell)[1];\r\n\r\n if (pos === 0) {\r\n table.addColumnStart();\r\n } else {\r\n table.addColumnAfter(pos - 1);\r\n }\r\n };\r\n\r\n /*\r\n * Luckily, thisfunction is simple, \r\n * it just add a row to the end of table.\r\n */\r\n\r\n table.addRowToTheEnd = function () {\r\n let r = table.insertRow(-1),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Yet another simple function, \r\n * it just add a row to the start of table.\r\n */\r\n\r\n table.addRowToTheStart = function () {\r\n let r = table.insertRow(0),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /* \r\n * This function adds a row before the current one.\r\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\r\n * the most of the troubles is not here.\r\n */\r\n\r\n table.addRowBefore = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellNew;\r\n for( let i = row - 1; i >= 0; i-- ) {\r\n let rowChildren = table.rows[i].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for( let j = 0; j < rowChildrenLength; j++ ) {\r\n if( rowChildren[j].rowSpan == 1 ) {\r\n row = i;\r\n cellNew = true;\r\n break;\r\n }\r\n }\r\n }\r\n if ( cellNew ) {\r\n break;\r\n }\r\n }\r\n\r\n if (row === 0) {\r\n table.addRowToTheStart();\r\n } else {\r\n table.addRowAfter( row, cellStyle );\r\n }\r\n };\r\n\r\n /*\r\n * Well... by the name convention of the previous 3 functions,\r\n * it's pretty obvious that this functions attaches a new\r\n * row after highlighted cell row. The greatest obstacle it was\r\n * the possibility of a TR not having the exact amount of columns\r\n * occuped by actual node but rowspanned upper cells. For that purpose\r\n * it was created the function realTimeArray.\r\n * @see realTimeArray\r\n */\r\n\r\n table.addRowAfter = function ( row, cellStyle ) {\r\n let cellRowSpan,\r\n rowAfter,\r\n aux;\r\n \r\n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\r\n let cell = document.querySelector('.wptb-highlighted');\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellRowSpan = cell.rowSpan,\r\n rowAfter = row + cellRowSpan - 1;\r\n } else {\r\n rowAfter = row;\r\n }\r\n \r\n \r\n let cellsColSpan = 0;\r\n if ( rowAfter < table.rows.length -1 ) {\r\n for( let i = 0; i <= rowAfter ; i++ ) {\r\n let tableRowsIChildren = table.rows[i].children,\r\n tableRIChildrenLength = tableRowsIChildren.length;\r\n if( tableRIChildrenLength > 0 ) {\r\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\r\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\r\n\r\n if ( rowIRowSpan - 1 + i > rowAfter ) {\r\n tableRowsIChildren[j].rowSpan++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let rNext = table.rows[rowAfter + 1],\r\n rNextChildren = rNext.children,\r\n rNextChildrenLength = rNextChildren.length;\r\n \r\n if( rNextChildrenLength > 0 ) {\r\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\r\n cellsColSpan += rNextChildren[i].colSpan;\r\n }\r\n }\r\n } else {\r\n cellsColSpan = array[0].length;\r\n }\r\n \r\n let r = table.insertRow( rowAfter + 1 );\r\n r.classList.add( 'wptb-row' );\r\n \r\n for ( j = 0; j < cellsColSpan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyle );\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n r.appendChild( td.getDOMElement() );\r\n }\r\n\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This function checks the current selected cells\r\n * make a rectangular shape.\r\n * @param Array the abstract table.\r\n * @return false, if not making a rectangle, or\r\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\r\n */\r\n\r\n table.isSquare = function (a) {\r\n var rowStart = -1,\r\n columnStart = -1,\r\n rowEnd = -1,\r\n columnEnd = -1,\r\n height,\r\n width,\r\n itemsEstimate = 0,\r\n items = 0;\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n if ( j < columnStart || columnStart == -1 ) {\r\n columnStart = j;\r\n }\r\n if ( i < rowStart || rowStart == -1 ) {\r\n rowStart = i;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n for (var i = a.length - 1; i > -1; i--) {\r\n for (var j = a[i].length - 1; j > -1; j--) {\r\n if (a[i][j] == 1) {\r\n if ( j > columnEnd ) {\r\n columnEnd = j;\r\n }\r\n if ( i > rowEnd ) {\r\n rowEnd = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = rowStart; i < rowEnd; i++) {\r\n for (var j = columnStart; j < columnEnd; j++) {\r\n if (a[i][j] == 0 || a[i][j] == undefined) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n items++;\r\n }\r\n }\r\n }\r\n\r\n height = rowEnd - rowStart + 1;\r\n width = columnEnd - columnStart + 1;\r\n itemsEstimate = height * width;\r\n\r\n if (itemsEstimate !== items) {\r\n return false;\r\n }\r\n return [height, width];\r\n };\r\n\r\n /*\r\n * This function merges all selected cells.\r\n * Well, actually sets the colspan and rowspan of first \r\n * upper left cell in selection and deletes the another selected cells.\r\n */\r\n\r\n table.mergeCells = function () {\r\n var dimensions = table.isSquare(array),\r\n rowspan = dimensions[0],\r\n colspan = dimensions[1],\r\n first = document.querySelector('.wptb-highlighted'),\r\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\r\n tdsChildrenNew = [];\r\n\r\n for (let i = 0; i < tds.length; i++) {\r\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\r\n if (tdsInternalElements.length > 0) {\r\n let tdsIntElemLength = tdsInternalElements.length;\r\n for (let j = 0; j < tdsIntElemLength; j++) {\r\n tdsChildrenNew.push(tdsInternalElements[j]);\r\n }\r\n }\r\n let p = tds[i].parentNode;\r\n p.removeChild(tds[i]);\r\n }\r\n if (tdsChildrenNew.length > 0) {\r\n for (let i = 0; i < tdsChildrenNew.length; i++) {\r\n first.appendChild(tdsChildrenNew[i]);\r\n }\r\n }\r\n\r\n first.colSpan = colspan;\r\n first.rowSpan = rowspan;\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n let firstWidth = first.style.width;\r\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\r\n if( firstWidth ) {\r\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\r\n } else if( firstDataFixedWidth ) {\r\n table.addColumnWidth();\r\n } else {\r\n table.addColumnWidth( false, true );\r\n }\r\n \r\n let firstHeight = first.style.height;\r\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\r\n if( firstHeight ) {\r\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\r\n } else if( firstDataFixedHeight ) {\r\n table.addRowHeight();\r\n } else {\r\n table.addRowHeight( false, true );\r\n }\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This functions makes the exact inverse as above.\r\n * It resets colspan and rowspan and appends \r\n * the same amount in cells to the table.\r\n * @bug\r\n */\r\n\r\n table.splitCell = function () {\r\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\r\n rowspan = cell.rowSpan,\r\n colspan = cell.colSpan,\r\n cellStyles = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n thisRow = table.rows[row],\r\n cellXIndex =cell.dataset.xIndex;\r\n \r\n cell.rowSpan = 1;\r\n cell.colSpan = 1;\r\n \r\n for (let i = 1; i < colspan; i++) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().classList.add( 'wptb-highlighted' );\r\n if ( cell.nextSibling ) {\r\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\r\n } else {\r\n thisRow.appendChild( td.getDOMElement() );\r\n }\r\n \r\n }\r\n\r\n if (rowspan > 1) {\r\n for (let i = 1; i < rowspan; i++) {\r\n let rowChildInsertBefore = undefined,\r\n rowNext = table.rows[row + i],\r\n rowChildren = rowNext.children,\r\n rowChildrenLength = rowChildren.length;\r\n \r\n if ( rowChildrenLength > 0 ) {\r\n for ( let k = 0; k < rowChildrenLength; k++ ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\r\n rowChildInsertBefore = rowChildren[k];\r\n break;\r\n } \r\n }\r\n }\r\n for ( let j = 0; j < colspan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyles );\r\n if ( rowChildInsertBefore != undefined ) {\r\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\r\n } else {\r\n rowNext.appendChild( td.getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Searches for rowspanned cells up to row number meeting it.\r\n * @param number the number of row where the function\r\n * must search up to.\r\n */\r\n\r\n table.findRowspannedCells = function (row) {\r\n var array = [],\r\n difference;\r\n actualPoints = getActualPointsInRow(row);\r\n if (actualPoints === maxAmountOfCells) {\r\n return [];\r\n }\r\n difference = maxAmountOfCells - actualPoints;\r\n\r\n for (var i = row - 1; i >= 0 && difference; i--) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n if (tds[i].rowSpan > 1) {\r\n array.push(tds[i]);\r\n difference -= tds[i].colSpan;\r\n }\r\n }\r\n }\r\n return array;\r\n\r\n }\r\n\r\n /*\r\n * This function explores the table and adds \r\n * a cell for each lacking one for each row\r\n * to meet an even amount of cells.\r\n */\r\n\r\n table.addLackingCells = function () {\r\n var sumRows = [];\r\n for (var i = 0; i < table.rows.length; i++) {\r\n sumRows.push(0);\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tds[j].rowSpan > 1) {\r\n for (var k = 1; k < tds[j].rowSpan; k++) {\r\n sumRows[i + k]++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td'),\r\n totalColspan = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n totalColspan += tds[j].colSpan;\r\n }\r\n totalColspan += sumRows[i];\r\n difference = maxAmountOfCells - totalColspan;\r\n for (var j = 0; j < difference; j++) {\r\n var td = new WPTB_Cell(mark);\r\n table.rows[i].appendChild(td.getDOMElement());\r\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * This function deletes the row of currently\r\n * selected cell. \r\n */\r\n\r\n table.deleteRow = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyles = cell.getAttribute('style'),\r\n rowspan = cell.rowSpan,\r\n row = getCoords(cell)[0],\r\n thisRow,\r\n aux;\r\n \r\n if ( rowspan == undefined ) rowspan = 1;\r\n \r\n for ( let i = 0; i < rowspan; i++ ) {\r\n thisRow = table.rows[row];\r\n let thisRowChildren = thisRow.children,\r\n nextRow = table.rows[row + 1],\r\n nextRowChildren,\r\n nextRowChildrenLength,\r\n tdArr = [];\r\n\r\n if( nextRow != undefined ) {\r\n nextRowChildren = nextRow.children;\r\n nextRowChildrenLength = nextRowChildren.length;\r\n for (let j = 0; j < thisRowChildren.length; j++) {\r\n if ( thisRowChildren[j].rowSpan > 1 ) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\r\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\r\n\r\n let nextRowChildrenK = undefined;\r\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\r\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\r\n nextRowChildrenK = nextRowChildren[k];\r\n break;\r\n } \r\n }\r\n\r\n if ( nextRowChildrenK ) {\r\n tdArr.push( [td, nextRowChildrenK] );\r\n } else {\r\n tdArr.push( [td] );\r\n }\r\n }\r\n }\r\n\r\n if ( tdArr.length > 0 ) {\r\n for ( let k = 0; k < tdArr.length; k++ ) {\r\n if ( tdArr[k][1] != undefined ) {\r\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\r\n } else {\r\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n \r\n let tableRows = table.rows;\r\n if ( tableRows.length > 0 ) {\r\n for ( let j = 0; j < row; j++ ) {\r\n let jRowChildren = tableRows[j].children;\r\n if ( jRowChildren.length > 0 ) {\r\n for ( let x = 0; x < jRowChildren.length; x++ ) {\r\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\r\n jRowChildren[x].rowSpan--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n aux = Array.from(array[0]);\r\n array.pop(aux);\r\n drawTable(array);\r\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\r\n \r\n if( table.rows.length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n /*\r\n * This function deletes the column of currently\r\n * selected cell. Again, this is way more complicated than\r\n * delete row case.\r\n */\r\n\r\n table.deleteColumn = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellXIndex = cell.dataset.xIndex,\r\n colspan = cell.colSpan;\r\n \r\n for ( let i = 0; i < colspan; i++ ) {\r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n let rowChildren = table.rows[j].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n } else {\r\n table.rows[j].removeChild( rowChildren[k] );\r\n }\r\n break;\r\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \r\n Number( rowChildren[k].dataset.xIndex ) + \r\n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n \r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n if (array[j] != undefined)\r\n array[j].pop();\r\n }\r\n \r\n maxAmountOfCells--;\r\n \r\n if( table.querySelectorAll( 'td' ).length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n\r\n array = fillTableArray();\r\n\r\n undoSelect();\r\n drawTable(array);\r\n\r\n wptbTableSetup.appendChild(table);\r\n //if (columns || rows) {\r\n table.recalculateIndexes( true );\r\n //}\r\n table.reconstraction();\r\n table.tdDefaultWidth();\r\n \r\n wptbTableSetup.onresize = function() {\r\n table.tdDefaultWidth();\r\n };\r\n\r\n WPTB_LeftPanel();\r\n \r\n // this code gets the ID of the active element in the toolbar \r\n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\r\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\r\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\r\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\r\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\r\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\r\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\r\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\r\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\r\n// }\r\n// }\r\n// }, false );\r\n// }\r\n \r\n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\r\n// if( wptbPanelLeft.length > 0 ) {\r\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }, false );\r\n// }\r\n \r\n// let body = document.getElementsByTagName( 'body' );\r\n// if( body.length > 0 ) {\r\n// body[0].addEventListener( 'click', function( e ) {\r\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }\r\n// }, false );\r\n// }\r\n};","var WPTB_TableStateSaveManager = function() {\n this.tableStateSet = () => {\n // get preview table\n let wptbPreviewTable = document.getElementsByClassName( 'wptb-preview-table' );\n if( wptbPreviewTable.length > 0 ) {\n wptbPreviewTable = wptbPreviewTable[0];\n \n // check if a global array doesn't exist with saved versions of the table \n // them create it\n if( ! window.wptbTableStateSaving ) {\n window.wptbTableStateSaving = [];\n } \n \n // remove the extra part of the array after changing the table \n // when it is showed in the not last modified version\n if( window.wptbTableStateSaving.length > window.wptbTableStateNumberShow + 1 ) {\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\n }\n \n //add new state of table\n let wptbNewPreviewTable = wptbPreviewTable.cloneNode( true );\n let wptbHighlighted = wptbNewPreviewTable.getElementsByClassName( 'wptb-highlighted' );\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\n }\n let wptbDirectlyhovered = wptbNewPreviewTable.getElementsByClassName( 'wptb-directlyhovered' );\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\n }\n \n let cssForTdsWidthAutoValue = '';\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAuto = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAuto ) {\n cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\n }\n }\n \n let mceContentBodys = wptbNewPreviewTable.querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n\n let dataMceStyle = wptbNewPreviewTable.querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n\n let mceIds = wptbNewPreviewTable.querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n \n window.wptbTableStateSaving.push( [wptbNewPreviewTable, cssForTdsWidthAutoValue] );\n \n // set new number of state which is showed now\n window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\n \n // make undo arrow active when the table was changed\n if( window.wptbTableStateSaving.length > 1 ) {\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\n }\n }\n \n // make redo arrow not active when the table was changed\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n }\n }\n \n this.tableStateGet = ( datawptbUndoredo ) => {\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 1 ) {\n \n // changes the number of the state which displays now\n if( datawptbUndoredo == 'undo' ) {\n if( window.wptbTableStateNumberShow > 0 ) {\n window.wptbTableStateNumberShow--;\n } else {\n return false;\n }\n } else if( datawptbUndoredo == 'redo' ) {\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n window.wptbTableStateNumberShow++;\n } else {\n return false;\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for undo button\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n }\n if( window.wptbTableStateNumberShow == 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow > 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for redo button\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n }\n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );\n if( wptbSaveBtn.length > 0 ) {\n wptbSaveBtn = wptbSaveBtn[0];\n if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) || \n window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {\n wptbSaveBtn.classList.add( 'wptb-save-disabled' );\n } else {\n wptbSaveBtn.classList.remove( 'wptb-save-disabled' );\n }\n }\n \n // load necessary saved table state\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n wptbTableSetup.innerHTML = '';\n wptbTableSetup.appendChild( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] );\n\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\n let cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n WPTB_Helper.settingsPanelClear();\n WPTB_Helper.elementOptionsPanelClear();\n WPTB_LeftPanel();\n\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \n if( wptbLeftScrollPanelCellSetting ) {\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\n }\n }\n }\n }\n}","var WPTB_Text = function ( text , DOMElementProt ) {\r\n let DOMElement = document.createElement('div'),\r\n elText2 = document.createElement('div'),\r\n elP = document.createElement('p'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n \r\n DOMElement.classList.add( 'wptb-text-container' );\r\n\r\n elP.innerHTML = text != undefined ? text : 'Text';\r\n elText2.appendChild(elP);\r\n DOMElement.appendChild(elText2);\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n\r\n let attributes = [...DOMElementProt.attributes];\r\n for( let i = 0; i < attributes.length; i++ ) {\r\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\r\n }\r\n } \r\n\r\n this.kind = 'text';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n return this;\r\n};"]}
|
inc/admin/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var WPTB_BorderMarkerActionsField=function c(){var s=this;if(this.wptbBorderMarker,this.wptbActions,0==document.getElementsByClassName("wptb-border-marker").length){var e=document.getElementsByTagName("body")[0];this.wptbBorderMarker=document.createElement("div"),this.wptbBorderMarker.classList.add("wptb-border-marker");var t=document.createElement("div"),a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("div");t.classList.add("wptb-border-marker-top"),a.classList.add("wptb-border-marker-right"),n.classList.add("wptb-border-marker-bottom"),l.classList.add("wptb-border-marker-left"),this.wptbBorderMarker.appendChild(t),this.wptbBorderMarker.appendChild(a),this.wptbBorderMarker.appendChild(n),this.wptbBorderMarker.appendChild(l),e.appendChild(this.wptbBorderMarker)}else this.wptbBorderMarker=document.getElementsByClassName("wptb-border-marker")[0];0!=document.getElementsByClassName("wptb-actions").length&&(this.wptbActions=document.getElementsByClassName("wptb-actions")[0]),this.addActionField=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,d=arguments[1];if(1==e){var t=void 0,a=void 0,n=void 0,l=void 0;if(0!=(l=document.getElementsByClassName("wptb-actions")).length)for(;0!=l.length;)l[0].parentNode.removeChild(l[0]);t=document.createElement("span"),a=document.createElement("span"),n=document.createElement("span"),(l=document.createElement("div")).classList.add("wptb-actions"),t.classList.add("dashicons","dashicons-trash","wptb-delete-action"),a.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),n.classList.add("dashicons","dashicons-move","wptb-move-action"),n.draggable=!0,l.appendChild(n),l.appendChild(a),l.appendChild(t),s.wptbBorderMarker.insertBefore(l,s.wptbBorderMarker.firstChild),l.activeElem=d,l.type=1,t.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;if(a.removeChild(t),"text"==t.kind){var n=a.parentNode;if(n.classList.contains("wptb-table-head")){var l=WPTB_Helper.findAncestor(n,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(l)}}new c(4).borderMarkerHide()},a.onclick=function(e){var t,a=void 0,n=e.target.parentNode.activeElem;t=n.className.match(/wptb-element-(.+)-(\d+)/i)[1];var l=n.parentNode;if("list"==t){for(var r=[],o=n.querySelectorAll("ul li .wptb-list-item-content"),i=0;i<o.length;i++)r.push(o[i].innerHTML);a=new WPTB_List(r,n),l.insertBefore(a.getDOMElement(),n.nextSibling)}else if("text"==t)a=new WPTB_Text(n.childNodes[0].innerHTML,n),l.insertBefore(a.getDOMElement(),n.nextSibling);else if("image"==t)a=new WPTB_Image(n.children[0].children[0].src,d),l.insertBefore(a.getDOMElement(),n.nextSibling);else{var s=n.childNodes[0].querySelector("p").innerHTML;a=new WPTB_Button(s,n),l.insertBefore(a.getDOMElement(),n.nextSibling)}WPTB_innerElementSet(a.getDOMElement()),new c(1,n).setParameters(n)},n.ondragstart=function(e){var t,a,n=WPTB_Helper.dragImagesArr(),l=e.target.parentNode,r=l.activeElem;a=(t=r.className.match(/wptb-element-(.+)-(\d+)/i))[1],l.style.opacity=0,r.classList.add("wptb-moving-mode"),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(n[a],0,0),e.dataTransfer.setData("node","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptb-moving-mode","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptbElIndic-"+t[1],"wptbElIndic-"+t[1]);var o=e.target.parentNode.activeElem;if("text"==o.kind){var i=o.parentNode.parentNode;if(i.classList.contains("wptb-table-head")){var s=WPTB_Helper.findAncestor(i,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(s)}}},l.style.right="-"+(parseFloat(d.offsetWidth)+3)+"px",l.style.display="block",s.wptbActions=l}else if(2==e){var r=void 0,o=void 0,i=void 0;if(0!=(i=document.getElementsByClassName("wptb-actions")).length)for(;0!=i.length;)i[0].parentNode.removeChild(i[0]);r=document.createElement("span"),o=document.createElement("span"),(i=document.createElement("span")).classList.add("wptb-actions"),r.classList.add("dashicons","dashicons-trash","wptb-delete-action"),o.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),i.append(o,r),s.wptbBorderMarker.insertBefore(i,s.wptbBorderMarker.firstChild),i.activeElem=d,i.type=2,r.onclick=function(e){var t=e.target.parentNode,a=t.activeElem,n=a.parentNode;new c(4).wptbBorderMarker.removeChild(t),n.removeChild(a),WPTB_Helper.listItemsRecalculateIndex(n)},o.onclick=function(e){var t=d.getBoundingClientRect(),a=t.top,n=e.target.parentNode.activeElem,l=n.querySelector(".wptb-list-item-content").innerHTML,r=new WPTB_ListItem(l,n,!0);n.parentNode.insertBefore(r.getDOMElement(),d.nextSibling),WPTB_Helper.listItemsTinyMceInit(r.getDOMElement().firstChild);var o=d.getElementsByClassName("wptb-list-item-content");(0<o.length&&(o=o[0]),setTimeout(function(){o.innerHTML=l,WPTB_Helper.listItemsRecalculateIndex(n.parentNode)},5),a!=(t=d.getBoundingClientRect()).top)&&new c(2,d).setParameters(d)},i.style.right="-"+(parseFloat(d.offsetWidth)+3)+"px",i.style.display="block",s.wptbActions=i}},this.setParameters=function(t){var e=t.getBoundingClientRect(),a=document.getElementsByClassName("wptb-container")[0],n=function(){var e=t.getBoundingClientRect();s.wptbBorderMarker.style.top=e.top+"px"};a.removeEventListener("scroll",n,!1),s.wptbBorderMarker.style.top=parseFloat(e.top)-2+"px",s.wptbBorderMarker.style.left=parseFloat(e.left)-2+"px";var l=s.wptbBorderMarker.querySelector(".wptb-border-marker-top");l.style.width=parseFloat(t.offsetWidth)+3+"px";var r=s.wptbBorderMarker.querySelector(".wptb-border-marker-right");r.style.height=parseFloat(e.bottom)-parseFloat(e.top)+4+"px",r.style.left=parseFloat(t.offsetWidth)+3+"px";var o=s.wptbBorderMarker.querySelector(".wptb-border-marker-bottom");o.style.width=l.style.width,o.style.top=parseFloat(e.bottom)-parseFloat(e.top)+3+"px",s.wptbBorderMarker.querySelector(".wptb-border-marker-left").style.height=r.style.height,s.wptbBorderMarker.style.display="block",a.addEventListener("scroll",n,!1)},this.leaveFromField=function(e,n,t){if(null!=e.relatedTarget)if(e.relatedTarget.classList.contains("wptb-border-marker")||e.relatedTarget.classList.contains("wptb-border-marker-top")||e.relatedTarget.classList.contains("wptb-border-marker-right")||e.relatedTarget.classList.contains("wptb-border-marker-bottom")||e.relatedTarget.classList.contains("wptb-border-marker-left")||"td"==e.relatedTarget.localName){if(s.wptbBorderMarker.style.display="none",s.wptbActions.style.display="none",2==s.wptbActions.type){var a=WPTB_Helper.findAncestor(n,"wptb-list-item-container"),l=new c;l.addActionField(1,a),l.setParameters(a)}}else(e.relatedTarget.classList.contains("wptb-actions")||e.relatedTarget.classList.contains("wptb-move-action")||e.relatedTarget.classList.contains("wptb-duplicate-action")||e.relatedTarget.classList.contains("wptb-delete-action"))&&(s.wptbActions.onmouseleave=function(e){if(null!=e.relatedTarget&&"td"==e.relatedTarget.localName&&(s.wptbBorderMarker.style.display="none",s.wptbActions.style.display="none",2==s.wptbActions.type)){var t=WPTB_Helper.findAncestor(n,"wptb-list-item-container"),a=new c;a.addActionField(1,t),a.setParameters(t)}})},this.borderMarkerHide=function(){s.wptbBorderMarker.style.display="none"},this.actionsRemove=function(){var e=s.wptbBorderMarker.getElementsByClassName("wptb-actions");0<e.length&&(e=e[0],s.wptbBorderMarker.removeChild(e))}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}document.addEventListener("DOMContentLoaded",function(){var e=WPTB_Helper.detectMode();if(e){var a=new XMLHttpRequest,t=ajaxurl+"?action=get_table&id="+e;a.open("GET",t,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(e){if(4!=this.readyState||200!=this.status);else{var t=JSON.parse(a.responseText);document.getElementById("wptb-setup-name").value=t[0],t[1]?(document.getElementsByClassName("wptb-table-generator")[0].style.display="none",document.getElementsByClassName("wptb-table-setup")[0].appendChild(WPTB_Parser(t[1])),WPTB_Table(),WPTB_LeftPanel(),WPTB_Settings()):document.getElementsByClassName("wptb-table-generator")[0].style.display="table"}},a.send(null)}else document.getElementsByClassName("wptb-table-generator")[0].style.display="table";document.counter=new ElementCounters,document.select=new MultipleSelect,WPTB_Initializer(),settings=WPTB_Settings()});var WPTB_Button=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("a"),r=document.createElement("div"),o=document.createElement("p"),i=void 0,s=!1;if(a.classList.add("wptb-button-container","wptb-size-M","wptb-"),n.classList.add("wptb-button-wrapper"),r.classList.add("wptb-button"),o.innerHTML=null!=e?e:"Button Text",t){var d=t.className.match(/wptb-element-((.+-)\d+)/i);d&&Array.isArray(d)&&(i=d[1],s=!0);var c=[].concat(_toConsumableArray(t.attributes));if(0<c.length)for(var p=0;p<c.length;p++)a.setAttribute(c[p].name,c[p].value);var m=t.querySelector(".wptb-button-wrapper");if(m){var u=[].concat(_toConsumableArray(m.attributes));if(0<u.length)for(var b=0;b<u.length;b++)"style"==u[b].name&&n.setAttribute(u[b].name,u[b].value)}var g=t.querySelector("a");if(g)if(0<(h=[].concat(_toConsumableArray(g.attributes))).length)for(var w=0;w<h.length;w++)"style"!=h[w].name&&"href"!=h[w].name&&"target"!=h[w].name||l.setAttribute(h[w].name,h[w].value);var h,y=t.querySelector(".wptb-button");if(y)if(0<(h=[].concat(_toConsumableArray(y.attributes))).length)for(var v=0;v<h.length;v++)"style"==h[v].name&&r.setAttribute(h[v].name,h[v].value)}return n.appendChild(l),l.appendChild(r),r.appendChild(o),a.appendChild(n),this.kind="button",this.getDOMElement=function(){return a},applyGenericItemSettings(this,i,s),this},WPTB_Cell=function(e,i){if(!i){(i=document.createElement("td")).style.padding=jQuery("#wptb-table-padding-number").val()+"px";var t=jQuery("#wptb-table-inner-border-number").val();""!=t&&0!=parseInt(t)&&(i.style.border=t+"px solid "+jQuery("#wptb-table-border-color").val()),i.classList.add("wptb-droppable","wptb-cell")}i.draggable=!1,e&&(i.onclick=e),WPTB_innerElementSet(i);var s=i.getElementsByClassName("wptb-ph-element");if(0<s.length)for(var a=function(e){var t=i.getElementsByClassName("wptb-space-between");if(0<t.length)for(var a=0;a<t.length;a++)WPTB_Space(t[a]);s[e].getDOMElement=function(){return s[e]},WPTB_innerElementSet(s[e]);var n=s[e].className.match(/wptb-element-((.+-)\d+)/i);if(n&&Array.isArray(n)){var l=n[1].split("-");if(s[e].kind=l[0],applyGenericItemSettings(s[e],n[1]),"list"==s[e].kind){var r=s[e].getElementsByTagName("li");if(0<r.length)for(var o=0;o<r.length;o++)WPTB_ListItem(void 0,r[o])}}},n=0;n<s.length;n++)a(n);return this.getDOMElement=function(){return i},this.setCoords=function(e,t){var a=this.getDOMElement();a.dataset.yIndex=e,a.dataset.xIndex=t},this.getCoords=function(){var e,t=this.getDOMElement();return e.x=t.dataset.xIndex,e.y=t.dataset.yIndex,e},this.appendElement=function(e){getDOMElement().appendChild(e)},i.getCellDimensions=function(){var e=window.getComputedStyle(this,null),t=e.getPropertyValue("padding-left"),a=e.getPropertyValue("padding-right"),n=e.getPropertyValue("border-left-width"),l=e.getPropertyValue("border-right-width"),r=e.getPropertyValue("padding-top"),o=e.getPropertyValue("padding-bottom"),i=e.getPropertyValue("border-top-width"),s=e.getPropertyValue("border-bottom-width");return{width:parseFloat(this.offsetWidth,10)-parseFloat(t,10)-parseFloat(a,10)-parseFloat(n,10)-parseFloat(l,10),height:parseFloat(this.offsetHeight,10)-parseFloat(r,10)-parseFloat(o,10)-parseFloat(i,10)-parseFloat(s,10)}},this},WPTB_DropHandle=function(s,e){var d=void 0,c=new WPTB_BorderMarkerActionsField;if(c.actionsRemove(),0==document.getElementsByClassName("wptb-drop-handle").length){var t=document.getElementsByTagName("body")[0];(d=document.createElement("div")).classList.add("wptb-drop-handle"),t.appendChild(d),d.ondragenter=function(){},d.ondragover=function(e){e.preventDefault()},d.ondragleave=function(){},d.ondrop=function(e){e.preventDefault();var t,a=void 0;e.dataTransfer.getData("wptbElement")?a=(a=(t=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:t.includes("image")?new WPTB_Image:t.includes("text")?new WPTB_Text:t.includes("button")?new WPTB_Button:void 0).getDOMElement():((a=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).classList.remove("wptb-moving-mode"),a.classList.remove("wptb-moving-into-same-elem")),a.classList.remove("wptb-ondragenter");var n=void 0;if("Drop Here"==d.dataset.text)"td"==(s=d.getDOMParentElement()).nodeName.toLowerCase()&&(n=d.getDOMParentElement()).appendChild(a);else{var l=d.getDOMParentElement();if(n=l.parentNode,"Above Element"==d.dataset.text)n.insertBefore(a,l);else if("Below Element"==d.dataset.text){var r=l.nextSibling;n.insertBefore(a,r)}}var o=n.parentNode;if(o.classList.contains("wptb-table-head")){var i=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(i)}d.style.display="none",c.borderMarkerHide(),WPTB_innerElementSet(a)}}else d=document.getElementsByClassName("wptb-drop-handle")[0];if(!s||"td"!=s.nodeName.toLowerCase()||0==s.getElementsByClassName("wptb-ph-element").length){var a=void 0;if("td"==s.localName?a=s.parentNode:"div"==s.localName&&s.classList.contains("wptb-ph-element")&&(a=s.parentNode.parentNode),a.classList.contains("wptb-table-head")){for(var n=e.dataTransfer.types,l=!1,r=0;r<n.length;r++){var o=n[r].match(/wptbelindic-([a-z]+)/i);if(o&&"text"!=o[1]){l=!0;break}}if(l)return}d.style.width=s.offsetWidth+4+"px";var i=s.offsetHeight,p=s.getBoundingClientRect(),m=Number(p.left),u=void 0;if(d.style.left=m-2+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var b=document.getElementsByClassName("wptb-moving-mode")[0];s==b?(d.classList.add("wptb-moving-into-same-elem"),c.wptbBorderMarker.classList.add("wptb-moving-into-same-elem")):(d.classList.remove("wptb-moving-into-same-elem"),c.wptbBorderMarker.classList.remove("wptb-moving-into-same-elem"))}d.getDOMParentElement=function(){return s},d.style.display="block";var g=c.wptbActions;g&&(g.style.display="none");var w=document.getElementsByClassName("wptb-container")[0],h=function(){var e=s.getBoundingClientRect();c.wptbBorderMarker.style.top=e.top+"px"};if(w.removeEventListener("scroll",h,!1),"td"!=s.nodeName.toLowerCase()){var y=null==e.offsetY?e.layerY:e.offsetY;u=parseFloat(p.top)-parseFloat(13),d.dataset.text="Above Element",i/2<y&&(u=parseFloat(p.top)+i+1,d.dataset.text="Below Element")}else d.dataset.text="Drop Here",u=parseFloat(p.top)+i/2-5;d.style.top=u+"px",w.addEventListener("scroll",h,!1),c.setParameters(s)}},ElementCounters=function(){var t=[];return t.text=0,t.image=0,t.list=0,t.button=0,this.increment=function(e){e in t&&t[e]++},this.nextIndex=function(e){if(e in t)return t[e]+1},this},WPTB_ElementOptions=function(e,t,a){var n,l=e.getDOMElement();prop=document.querySelector(".wptb-"+e.kind+"-options-prototype").cloneNode(!0),prop.classList.remove("wptb-"+e.kind+"-options-prototype"),n="wptb-options-"+e.kind+"-"+t;for(var r=prop.getElementsByClassName("wptb-element-property"),o=0;o<r.length;o++)r[o].dataset.element=n;if(prop.classList.add(n),document.getElementById("element-options-group").appendChild(prop),a)if("button"==e.kind){var i=document.getElementsByClassName("wptb-element-"+a)[0],s=void 0,d=void 0,c=void 0,p=void 0;if(i&&(p=i.className.match(/wptb-size-([a-z]+)/i)),p&&Array.isArray(p)){var m=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<m.length;o++)m[o].classList.remove("selected"),m[o].innerHTML==p[1]&&m[o].classList.add("selected")}if(i&&(s=i.getElementsByClassName("wptb-button-wrapper"),d=i.getElementsByTagName("a"),c=i.getElementsByClassName("wptb-button")),s){var u=s[0].style.justifyContent,b=prop.querySelector('select[data-type="button-alignment"]').getElementsByTagName("option"),g=void 0;"flex-start"==u?g="left":"center"!=u&&u?"flex-end"==u&&(g="right"):g="center";for(var w=0;w<b.length;w++)b[w].value==g&&(b[w].selected=!0)}if(0<d.length){var h=d[0].getAttribute("href"),y=d[0].getAttribute("target"),v=d[0].getAttribute("id"),f=prop.querySelector('input[data-type="button-link"]'),B=prop.querySelector('input[data-type="button-link-target"]'),E=B.getAttribute("id"),C=B.parentNode.getElementsByTagName("label")[0],T=prop.querySelector('input[data-type="button-id"]');E=E+"-"+a.split("-")[1],B.setAttribute("id",E),C.setAttribute("for",E),f.value=h,y&&"_blank"==y&&(B.checked=!0),T.value=v}if(c){var x=c[0].style.color,I=c[0].style.backgroundColor,k=prop.querySelector('input[data-type="button-text-color"]'),N=prop.querySelector('input[data-type="button-color"]');k.value=WPTB_Helper.rgbToHex(x),N.value=WPTB_Helper.rgbToHex(I)}}else if("image"==e.kind){var S=document.getElementsByClassName("wptb-element-"+a);if(0<S.length){var _=S[0].getElementsByClassName("wptb-image-wrapper");if(0<_.length){for(var A=(_=_[0]).style.textAlign,L=prop.querySelector('select[data-type="image-alignment"]').getElementsByTagName("option"),W=0;W<L.length;W++)L[W].value==A&&(L[W].selected=!0);var P=_.getElementsByTagName("a");if(0<P.length){var M=P[0];if(M){M.onclick=function(e){e.preventDefault()};var H=M.getAttribute("href"),D=prop.querySelector('input[data-type="image-link"]');H&&(D.value=H);var q=M.getAttribute("target"),F=prop.querySelector('input[data-type="image-link-target"]'),O=F.getAttribute("id"),R=F.parentNode.getElementsByTagName("label")[0];O=O+"-"+a.split("-")[1],F.setAttribute("id",O),R.setAttribute("for",O),q&&"_blank"==q&&(F.checked=!0);var z=M.style.width;if(z){var j=prop.querySelector('input[type="range"][data-type="image-size"]'),Q=prop.querySelector('input[type="number"][data-type="image-size"]');j.value=parseInt(z),Q.value=parseInt(z)}var V=M.getElementsByTagName("img");if(0<V.length){var G=V[0].getAttribute("alt");prop.querySelector('input[type="text"][data-type="alternative-text"]').value=G}}}}}}else if("text"==e.kind){var J=document.getElementsByClassName("wptb-element-"+a);if(0<J.length){var Y=J[0].style.fontSize,K=J[0].style.color,X=prop.querySelector('input[type="range"][data-type="font-size"]'),U=prop.querySelector('input[type="number"][data-type="font-size"]'),$=prop.querySelector('input[type="text"][data-type="color"]');X.value=parseInt(Y)?parseInt(Y):10,U.value=parseInt(Y)?parseInt(Y):10,$.value=WPTB_Helper.rgbToHex(K)}}else if("list"==e.kind){var Z=document.getElementsByClassName("wptb-element-"+a);if(0<Z.length){var ee=Z[0].querySelector("p").style.color;prop.querySelector('input[type="text"][data-type="list-text-color"]').value=WPTB_Helper.rgbToHex(ee);var te=Z[0].querySelectorAll("li");if(0<te.length){var ae=te[0].querySelector("p").classList;if(0<ae.length){var ne=prop.querySelector('select[data-type="list-class"]');if(ne){ne.value="unordered";for(var le=ne.parentNode.nextSibling,re=0;re<10&&"1"!=le.nodeType;re++)le=le.nextSibling;if(le){var oe=le.getAttribute("id");le.setAttribute("id",oe+"-"+a),le.style.display="flex"}var ie=prop.querySelector('select[data-type="list-style-type"]');ie&&(ie.parentNode.style.display="flex",ae.contains("wptb-list-style-type-disc")?ie.value="disc":ae.contains("wptb-list-style-type-circle")?ie.value="circle":ae.contains("wptb-list-style-type-square")?ie.value="square":ae.contains("wptb-list-style-type-none")&&(ie.value="none"))}}}var se=Z[0].getElementsByClassName("wptb-list-item-content");if(0<se.length){for(var de=[],ce=0;ce<se.length;ce++){var pe=se[ce].querySelector("p");pe&&(pe.style.textAlign?de.push(pe.style.textAlign):de.push("left"))}var me=0,ue=0,be=0;if(0<de.length)for(var ge=0;ge<de.length;ge++)de[ge]&&("left"==de[ge]?me++:"center"==de[ge]?ue++:"right"==de[ge]&&be++);var we=prop.querySelector('select[data-type="list-alignment"]'),he=Math.max(me,ue,be);me==he?we.value="left":ue==he?we.value="center":be==he&&(we.value="right")}}}if(l.onclick=function(){var e=this.className.match(/wptb-element-((.+-)\d+)/i),t=".wptb-"+e[2]+"options.wptb-options-"+e[1];document.getElementsByClassName("wptb-elements-container")[0].style.display="none",document.getElementsByClassName("wptb-settings-section")[0].style.display="none",document.getElementById("element-options-group").style.display="block";for(var a=document.getElementById("element-options-group").childNodes,n=0;n<a.length;n++)a[n].style&&(a[n].style.display="none");document.querySelector(t).style.display="block"},"button"==e.kind){var ye=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<ye.length;o++)ye[o].onclick=function(){var e=this.innerHTML,t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0];l.classList.remove("wptb-size-S"),l.classList.remove("wptb-size-M"),l.classList.remove("wptb-size-L"),l.classList.remove("wptb-size-XL"),l.classList.add("wptb-size-"+e);for(var r=this.parentNode.getElementsByClassName("wptb-btn-size-btn"),o=0;o<r.length;o++)r[o].classList.remove("selected");this.classList.add("selected")}}var ve=prop.getElementsByClassName("wptb-element-property");for(o=0;o<ve.length;o++){if(ve[o].classList.contains("wptb-color-picker")&&jQuery(ve[o]).wpColorPicker({change:function(e,t){var a,n,l,r=e.target;if(n=(a=r.dataset.element.match(/wptb-options-(.+)-(\d+)/i))[1],l=a[2],affectedEl=document.getElementsByClassName("wptb-element-"+n+"-"+l)[0],"button"==n)"button-text-color"==r.dataset.type?affectedEl.getElementsByClassName("wptb-button")[0].style.color=t.color.toString():affectedEl.getElementsByClassName("wptb-button")[0].style.backgroundColor=t.color.toString();else if("list"==n){var o=affectedEl.querySelectorAll("p");if(0<o.length)for(var i=0;i<o.length;i++)o[i].style.color=t.color.toString()}else affectedEl.style.color=t.color.toString()}}),"font-size"===ve[o].dataset.type)ve[o].parentNode.parentNode.getElementsByClassName("wptb-text-font-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].onchange()};if("image-size"===ve[o].dataset.type)ve[o].parentNode.parentNode.getElementsByClassName("wptb-image-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].onchange()};ve[o].onchange=function(e){var t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0],r=this.value;switch(this.dataset.type){case"src":l.getElementsByTagName("img")[0].src=this.value;break;case"alternative-text":l.getElementsByTagName("img")[0].alt=this.value;break;case"image-link":l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value);break;case"image-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"image-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"image-size":l.getElementsByTagName("a")[0].style.width=this.value+"%",l.getElementsByTagName("a")[0].style.height="auto",this.parentNode.parentNode.getElementsByClassName("wptb-image-size-slider")[0].value=this.value;break;case"image-alignment":l.getElementsByClassName("wptb-image-wrapper")[0].style.textAlign=this.value;break;case"font-size":l.style.fontSize=r+"px",this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-slider")[0].value=this.value;break;case"button-alignment":var o="";o="left"==this.value?"start":"right"==this.value?"flex-end":"center",l.getElementsByClassName("wptb-button-wrapper")[0].style.justifyContent=o;break;case"button-link":this.value?l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value):l.getElementsByTagName("a")[0].removeAttribute("href");break;case"button-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"button-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"button-id":this.value?l.getElementsByTagName("a")[0].id=this.value:l.getElementsByTagName("a")[0].removeAttribute("id");case"button-color":break;case"list-alignment":for(var i=l.querySelectorAll("li"),s=0;s<i.length;s++){var d=i[s].querySelector("p");d&&(d.style.textAlign=this.value)}break;case"list-class":var c=e.target.parentNode.parentNode.querySelector("[data-type=list-style-type]").parentNode,p=c.parentNode;if("unordered"==r){c.style.display="flex",p.querySelector(".wptb-list-icon-select-label").style.display="flex";var m=l.querySelectorAll("li");for(s=0;s<m.length;s++){var u=m[s].querySelector("p");u.removeAttribute("class"),u.classList.add("wptb-list-style-type-disc")}p.querySelector("[data-type=list-style-type]").value="disc"}else{c.style.display="none",p.querySelector(".wptb-list-icon-select-label").style.display="none";var b=l.querySelectorAll("li");for(s=0;s<b.length;s++){b[s].querySelector("p").removeAttribute("class")}}break;case"list-style-type":for(b=l.querySelectorAll("li"),s=0;s<b.length;s++){var g=b[s].querySelector("p");g.removeAttribute("class"),g.classList.add("wptb-list-style-type-"+r.toLowerCase())}}}}},WPTB_Helper={hexToRgb:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+parseInt(t[1],16)+","+parseInt(t[2],16)+","+parseInt(t[3],16)+")":null},rgbToHex:function(e){return(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""},getDragImageCustom:function(e){var t=location.protocol+"//"+location.hostname,a=document.createElement("img");return a.src=t+"/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/"+e+".png",a},dragImagesArr:function(){return{text:WPTB_Helper.getDragImageCustom("text"),image:WPTB_Helper.getDragImageCustom("image"),button:WPTB_Helper.getDragImageCustom("button"),list:WPTB_Helper.getDragImageCustom("list")}},listItemsRecalculateIndex:function(e){var t=e.querySelectorAll("p");if(0<t.length)for(var a=0;a<t.length;a++)t[a].dataset.listStyleTypeIndex=Number(a)+1+"."},listItemsTinyMceInit:function(e){tinyMCE.init({target:e,inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("keydown",function(e){var t=e.target.parentNode;if(13==e.keyCode){e.preventDefault();var a=e.target.innerHTML,n=new WPTB_ListItem(a,t,!0);t.parentNode.insertBefore(n.getDOMElement(),t),WPTB_Helper.listItemsTinyMceInit(n.getDOMElement().firstChild),e.target.querySelector("p").innerText="New List Item",WPTB_Helper.listItemsRecalculateIndex(t.parentNode)}else if("8"==e.keyCode||"46"==e.keyCode){var l=e.target.querySelector("p").innerHTML.replace(/<[^>]+>/g,"");if(""==(l=(l=l.replace(/\s+/g," ").trim()).replace(/ /g,"").trim()))e.preventDefault(),e.target.querySelector("p").innerText="\n";else{var r=WPTB_Helper.getSelectionText();(r=(r=r.replace(/\s+/g," ").trim()).replace(/ /g,"").trim())==l&&(e.preventDefault(),e.target.querySelector("p").innerText="\n")}}var o=e.target.parentNode;new WPTB_BorderMarkerActionsField(2,o).setParameters(o)}),e.on("keyup",function(e){var t=e.target.parentNode;new WPTB_BorderMarkerActionsField(2,t).setParameters(t)})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},buttonsTinyMceInit:function(a){tinyMCE.init({target:a,inline:!0,plugins:"link",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",toolbar:"bold italic strikethrough",setup:function(e){e.on("keydown",function(e){13==e.keyCode&&e.preventDefault();var t=WPTB_Helper.findAncestor(a,"wptb-button-container");new WPTB_BorderMarkerActionsField(1,t).setParameters(t)}),e.on("keyup",function(e){var t=WPTB_Helper.findAncestor(a,"wptb-button-container");new WPTB_BorderMarkerActionsField(1,t).setParameters(t)})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},linkHttpCheckChange:function(e){if(e){if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))return e;var t=e.split("/"),a=void 0;return Array.isArray(t)&&0<t.length&&(a=t[t.length-1]),document.location.protocol+"//"+a}return""},dataTitleColumnSet:function(e){for(var t=e.rows,a=t[0],n=getComputedStyle(a),l=a.children,r={},o=0;o<l.length;o++){for(var i=l[o].children,s=0;s<i.length;s++){var d=i[s];if(d.classList.contains("wptb-ph-element"))if("text"==d.className.match(/wptb-element-(.+)-(\d+)/i)[1]){var c=d.querySelector("p"),p=c.textContent,m=c.style.textAlign;r[l[o].dataset.xIndex]=[p,d.style.fontSize,d.style.color,n.backgroundColor,m];break}}r[l[o].dataset.xIndex]||(r[l[o].dataset.xIndex]=["","","",n.backgroundColor,""])}for(var u=1;u<t.length;u++)for(var b=t[u].children,g=0;g<b.length;g++)r[b[g].dataset.xIndex]?(b[g].dataset.wptbTitleColumn=r[b[g].dataset.xIndex][0],b[g].dataset.wptbTitleColumnFontSize=r[b[g].dataset.xIndex][1],b[g].dataset.wptbTitleColumnColor=r[b[g].dataset.xIndex][2],b[g].dataset.wptbTitleBackgroundColor=r[b[g].dataset.xIndex][3],b[g].dataset.wptbTitleAlign=r[b[g].dataset.xIndex][4]):(b[g].dataset.wptbTitleColumn="",b[g].dataset.wptbTitleColumnFontSize="",b[g].dataset.wptbTitleColumnColor="",b[g].dataset.wptbTitleBackgroundColor="",b[g].dataset.wptbTitleAlign="")},findAncestor:function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},getSelectionText:function(){return window.getSelection?window.getSelection().toString():document.selection.createRange().text},settingsPanelClear:function(){document.getElementById("wptb-adaptive-table-checkbox").checked=!1,document.getElementById("wptb-top-row-as-header").checked=!1,document.getElementById("wptb-table-border-slider").value=0,document.getElementById("wptb-table-border-number").value=0,document.getElementById("wptb-inner-border-check").checked=!1,document.getElementById("wptb-apply-inner-border").classList.remove("visible"),document.getElementById("wptb-table-inner-border-slider").value=1,document.getElementById("wptb-table-inner-border-number").value=1,WPTB_Helper.wpColorPickerClear("wptb-table-border-color"),WPTB_Helper.wpColorPickerClear("wptb-table-header-bg"),WPTB_Helper.wpColorPickerClear("wptb-even-row-bg"),WPTB_Helper.wpColorPickerClear("wptb-odd-row-bg"),document.getElementById("wptb-table-cell-slider").value=15,document.getElementById("wptb-table-cell-number").value=15},wpColorPickerClear:function(e){var t=document.getElementById(e),a=WPTB_Helper.findAncestor(t,"wp-picker-container"),n=a.parentNode;n.removeChild(a);var l=document.createElement("input");l.setAttribute("id",e),l.value="",n.appendChild(l)},detectMode:function(){var e=window.location.href,t=new RegExp("[?&]table(=([^&#]*)|&|#|$)").exec(e);return!!t&&(t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"")},getColumnWidth:function(e,t){for(var a=t.dataset.xIndex,n=e.querySelectorAll('[data-x-index="'+a+'"]'),l=t.getCellDimensions().width,r=0;r<n.length;r++)l>n[r].getCellDimensions().width&&(l=n[r].getCellDimensions().width);return l},getRowHeight:function(e,t){for(var a=t.dataset.yIndex,n=e.querySelectorAll('[data-y-index="'+a+'"]'),l=t.getCellDimensions().height,r=0;r<n.length;r++)l>n[r].getCellDimensions().height&&(l=n[r].getCellDimensions().height);return l}},WPTB_Image=function(e,t){var a=void 0,n=void 0,l=void 0,r=!1;if(null==t){a=document.createElement("div"),n=document.createElement("div");var o=document.createElement("a"),i=document.createElement("img");o.style.display="inline-block",o.appendChild(i),a.classList.add("wptb-image-container"),n.classList.add("wptb-image-wrapper"),n.appendChild(o),a.appendChild(n),o.onclick=function(e){e.preventDefault()},file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1}),file_frame.on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),i.src=attachment.url}),null==e?file_frame.open():i.src=e}else{(a=t.cloneNode(!0)).getElementsByTagName("a")[0].onclick=function(e){e.preventDefault()};var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(l=s[1],r=!0)}return this.kind="image",this.getDOMElement=function(){return a},applyGenericItemSettings(this,l,r),this},WPTB_Initializer=function(){var e=document.body;columnsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[0],columnsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[0],rowsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[1],rowsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[1],columnsInput=document.getElementById("wptb-columns-number"),rowsInput=document.getElementById("wptb-rows-number"),columnsDecrementButton.onclick=function(){1<columnsInput.value&&columnsInput.value--},columnsIncrementButton.onclick=function(){columnsInput.value<10&&columnsInput.value++},rowsDecrementButton.onclick=function(){1<rowsInput.value&&rowsInput.value--},rowsIncrementButton.onclick=function(){rowsInput.value<10&&rowsInput.value++},document.getElementById("wptb-generate-table").onclick=function(){var e=document.getElementById("wptb-columns-number").value,t=document.getElementById("wptb-rows-number").value;WPTB_Table(e,t)}},WPTB_LeftPanel=function(){var e,t,a,n,r=document.getElementsByClassName("wptb-preview-table")[0],l=document.getElementsByClassName("wptb-element");function o(e,t){if(!(3<t)&&r){var a=r.getElementsByTagName("tr");if(a.length>t){var n=a[t].style.backgroundColor,l=document.getElementById(e);l&&n&&(l.value=WPTB_Helper.rgbToHex(n))}}}function i(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.borderWidth=document.querySelector("#wptb-table-inner-border-number").value+"px",t[a].style.borderStyle="solid"}function s(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.padding=e+"px"}function d(e){r.style.borderWidth=e+"px",r.style.borderStyle="solid"}function c(e,t,a){e.onkeydown=function(){var e=this.value;0==(e=String(e))[0]?this.value="":(e=e.substring(0,t),this.value=e)},e.onkeyup=function(){var e=this.value;e=String(e),a<e&&(this.value=a)}}o("wptb-even-row-bg",1),jQuery("#wptb-even-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=1;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString()},clear:function(){for(var e=r.getElementsByTagName("tr"),t=1;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}}}),o("wptb-odd-row-bg",2),jQuery("#wptb-odd-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=2;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString()},clear:function(){for(var e=r.getElementsByTagName("tr"),t=2;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}}}),o("wptb-table-header-bg",0),jQuery("#wptb-table-header-bg").wpColorPicker({change:function(e,t){r.getElementsByTagName("tr")[0].style.backgroundColor=t.color.toString()},clear:function(){var e=r.getElementsByTagName("tr")[0];e.style.backgroundColor="";for(var t=e.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.backgroundColor=""}}),e=r,t=document.getElementById("wptb-adaptive-table-checkbox"),e&&e.dataset.wptbAdaptiveTable?t.checked=!0:t.checked=!1,a=r,n=document.getElementById("wptb-top-row-as-header"),a&&a.classList.contains("wptb-table-preview-head")?n.checked=!0:n.checked=!1,function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].style.borderColor;if(t){var a=document.getElementById("wptb-table-border-color");a&&(a.value=WPTB_Helper.rgbToHex(t))}var n=e[0].style.borderWidth;if(n){var l=document.getElementById("wptb-table-border-slider"),r=document.getElementById("wptb-table-border-number");l&&(l.value=parseInt(n)),r&&(r.value=parseInt(n))}var o=e[0].querySelector("td").style.borderWidth;if(o){var i=document.getElementById("wptb-inner-border-check"),s=document.getElementById("wptb-apply-inner-border");if(o&&0<parseInt(o)){if(i&&(i.checked=!0,s)){s.classList.add("visible");var d=document.getElementById("wptb-table-inner-border-slider"),c=document.getElementById("wptb-table-inner-border-number");d.value=parseInt(o),c.value=parseInt(o)}}else i.checked=!1}(n&&0<parseInt(n)||o&&0<parseInt(o))&&(document.getElementById("wptb-table-border-color-set-area").style.display="")}}(),jQuery("#wptb-table-border-color").wpColorPicker({change:function(e,t){var a=r.getElementsByTagName("td");r.style.border=document.querySelector("#wptb-table-border-number").value+"px solid "+t.color.toString();for(var n=0;n<a.length;n++){var l=document.querySelector("#wptb-table-inner-border-number").value;document.getElementById("wptb-inner-border-check").checked&&(a[n].style.border=(0!=l?l:1)+"px solid "+t.color.toString())}},clear:function(){var e=r.getElementsByTagName("td");r.style.borderColor="";for(var t=0;t<e.length;t++)e[t].style.borderColor=""}}),function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].querySelector("td");if(t){var a=t.style.padding;if(a){var n=document.getElementById("wptb-table-cell-slider"),l=document.getElementById("wptb-table-cell-number");n&&(n.value=parseInt(a)),l&&(l.value=parseInt(a))}}}}(),c(document.getElementById("wptb-table-border-number"),1,50),c(document.getElementById("wptb-table-inner-border-number"),1,50),c(document.getElementById("wptb-table-cell-number"),1,50),c(document.getElementById("wptb-text-font-size-number"),1,50),c(document.getElementById("wptb-image-width-number"),2,100),c(document.getElementById("wptb-table-column-width-number"),2,500),c(document.getElementById("wptb-table-row-height-number"),2,200),document.getElementById("wptb-table-cell-slider").oninput=function(){document.getElementById("wptb-table-cell-number").value=this.value,s(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-cell-number").onchange=function(){document.getElementById("wptb-table-cell-slider").value=this.value,s(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-border-slider").oninput=function(){document.getElementById("wptb-table-border-number").value=this.value,d(this.value),r.tdDefaultWidth();var e=document.getElementById("wptb-inner-border-check").checked,t=document.getElementById("wptb-table-border-color-set-area");0==this.value&&0==e?t.style.display="none":t.style.display=""},document.getElementById("wptb-table-border-number").onchange=function(){document.getElementById("wptb-table-border-slider").value=this.value,d(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-inner-border-slider").oninput=function(){document.getElementById("wptb-table-inner-border-number").value=this.value,i(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-inner-border-number").onchange=function(){document.getElementById("wptb-table-inner-border-slider").value=this.value,i(this.value),r.tdDefaultWidth()},document.getElementById("wptb-inner-border-check").onchange=function(){if(r){var e=this.checked?"checked":"unchecked";!function(e){var t=null!=document.querySelector("#wptb-table-border-color").value?document.querySelector("#wptb-table-border-color").value:"rgb(0,0,0)";0!=document.querySelector("#wptb-table-inner-border-slider").value&&0!=document.querySelector("#wptb-table-inner-border-number").value||(document.querySelector("#wptb-table-inner-border-slider").value=1,document.querySelector("#wptb-table-inner-border-number").value=1);var a=document.querySelector("#wptb-table-inner-border-slider").value+"px",n=document.getElementsByClassName("wptb-preview-table");if(0<n.length)if("checked"==e){document.getElementById("wptb-apply-inner-border").style.marginBottom="0px";for(var l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border=a+" solid "+t;document.getElementById("wptb-apply-inner-border").classList.add("visible")}else for(document.getElementById("wptb-apply-inner-border").classList.remove("visible"),l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border="0px solid "+t,l[r].style.border=null}(e);var t=document.getElementById("wptb-table-border-slider").value,a=document.getElementById("wptb-table-border-color-set-area");a.style.display="unchecked"==e&&0==t?"none":""}},document.getElementById("wptb-table-column-width-slider").oninput=function(){document.getElementById("wptb-table-column-width-number").value=this.value,r.addColumnWidth(this.value)},document.getElementById("wptb-table-column-width-number").onchange=function(){document.getElementById("wptb-table-column-width-slider").value=this.value,r.addColumnWidth(this.value)},document.getElementById("wptb-table-column-width-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getColumnWidth(r,e);r.addColumnWidth(t)}else{r.addColumnWidth(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getColumnWidth(r,a);document.getElementById("wptb-table-column-width-number").value=n,document.getElementById("wptb-table-column-width-slider").value=n}},document.getElementById("wptb-table-row-height-slider").oninput=function(){document.getElementById("wptb-table-row-height-number").value=this.value,r.addRowHeight(this.value)},document.getElementById("wptb-table-row-height-number").onchange=function(){document.getElementById("wptb-table-row-height-slider").value=this.value,r.addRowHeight(this.value)},document.getElementById("wptb-table-row-height-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getRowHeight(r,e);r.addRowHeight(t)}else{r.addRowHeight(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getRowHeight(r,a);document.getElementById("wptb-table-row-height-number").value=n,document.getElementById("wptb-table-row-height-slider").value=n}},document.getElementById("wptb-adaptive-table-checkbox").onchange=function(){this.checked?r.dataset.wptbAdaptiveTable=1:r.dataset.wptbAdaptiveTable=0},document.getElementById("wptb-top-row-as-header").onchange=function(){!function(e,t){if(t.checked)WPTB_Helper.dataTitleColumnSet(e),e.classList.add("wptb-table-preview-head"),e.rows[0].classList.add("wptb-table-head");else{var a=e.rows;e.classList.remove("wptb-table-preview-head"),a[0].classList.remove("wptb-table-head");for(var n=1;n<a.length;n++)for(var l=a[n].children,r=0;r<l.length;r++)l[r].removeAttribute("data-wptb-title-column"),l[r].removeAttribute("data-wptb-title-column-font-size"),l[r].removeAttribute("data-wptb-title-column-color"),l[r].removeAttribute("data-wptb-title-background-color"),l[r].removeAttribute("data-wptb-title-align")}}(r,this)};for(var p=0;p<l.length;p++)l[p].ondragstart=function(e){e.dataTransfer.setData("wptbElement",this.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+this.dataset.wptbElement,"wptbElIndic-"+this.dataset.wptbElement)};r&&(document.getElementById("wptb-activate-cell-management-mode").onclick=r.toggleTableEditMode,document.getElementById("wptb-table-edit-mode-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-left-scroll-panel-curtain-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-add-end-row").onclick=r.addRowToTheEnd,document.getElementById("wptb-add-start-row").onclick=r.addRowToTheStart,document.getElementById("wptb-add-row-before").onclick=r.addRowBefore,document.getElementById("wptb-add-row-after").onclick=r.addRowAfter,document.getElementById("wptb-add-end-column").onclick=r.addColumnEnd,document.getElementById("wptb-add-start-column").onclick=r.addColumnStart,document.getElementById("wptb-add-column-before").onclick=r.addColumnBefore,document.getElementById("wptb-add-column-after").onclick=r.addColumnAfter,document.getElementById("wptb-delete-column").onclick=r.deleteColumn,document.getElementById("wptb-delete-row").onclick=r.deleteRow,document.getElementById("wptb-merge-cells").onclick=r.mergeCells,document.getElementById("wptb-split-cell").onclick=r.splitCell),document.querySelector(".wptb-left-panel-extend").onclick=function(){var e=document.querySelector(".wptb-container");e&&(e.classList.contains("collapsed")?e.classList.remove("collapsed"):e.classList.add("collapsed"))},document.getElementsByClassName("wptb-builder-panel")[0].addEventListener("click",function(e){if(!(e.target.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.target,"wptb-ph-element")||e.target.classList.contains("wptb-fixed-toolbar")||WPTB_Helper.findAncestor(e.target,"wptb-fixed-toolbar"))){document.getElementsByClassName("wptb-elements-container")[0].style.display="table",document.getElementsByClassName("wptb-settings-section")[0].style.display="block",document.getElementById("element-options-group").style.display="none";var t=document.getElementById("wpcd_fixed_toolbar");t.hasAttribute("data-toolbar-active-id")&&document.getElementById(t.getAttribute("data-toolbar-active-id")).classList.remove("toolbar-active")}},!1)},WPTB_List=function(e,t){var a,n=document.createElement("ul"),l=document.createElement("div"),r=void 0,o=!1;if(l.classList.add("wptb-list-item-container"),this.kind="list",""===e);else if(e){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(d=0;d<e.length;d++){var s=t.querySelector("li");a=new WPTB_ListItem(e[d],s,!0),n.appendChild(a.getDOMElement())}}else for(var d=0;d<3;d++)a=new WPTB_ListItem("<p>List Item "+(d+1)+"</p>"),n.appendChild(a.getDOMElement());return l.appendChild(n),this.getDOMElement=function(){return l},applyGenericItemSettings(this,r,o),WPTB_Helper.listItemsRecalculateIndex(n),this},WPTB_ListItem=function(e,t,a){var n=void 0;if(null==t||t&&a){null==e&&(e="New List Item");var l=document.createElement("li");if((o=document.createElement("div")).classList.add("wptb-list-item-content"),t){var r=t.getAttribute("style");r&&l.setAttribute("style",r)}l.appendChild(o),o.innerHTML=e,o.onkeyup=window.listItemKeyListener,n=!0}else{var o;(o=(l=t).getElementsByClassName("wptb-list-item-content")[0]).onkeyup=window.listItemKeyListener,n=!1}if(l.onmouseenter=function(e){var t=new WPTB_BorderMarkerActionsField;t.addActionField(2,l),t.setParameters(l)},l.onmouseleave=function(e){return(new WPTB_BorderMarkerActionsField).leaveFromField(e,l,2),!1},this.getDOMElement=function(){return l},n)return this},MultipleSelect=function(){var l=[],a=!1;return this.activateMultipleSelectMode=function(){l=[];for(var e=document.getElementsByClassName("wptb-preview-table")[0].getElementsByTagName("td"),t=0;t<e.length;t++)e[t].classList.remove("wptb-highlighted");a=!0},this.deactivateMultipleSelectMode=function(){a=!1},this.isActivated=function(){return a},this.pushSelectedCell=function(e){a&&(l.push(e),e.classList.add("wptb-highlighted"))},this.selectedCells=function(){return l},this.flushSelectedCells=function(){l=[]},this.getFirst=function(){for(var e,t=1e3,a=1e3,n=l.length-1;0<=n;n--)t>=l[n].dataset.xIndex&&a>=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.getLast=function(){for(var e,t=-1,a=-1,n=l.length-1;0<=n;n--)t<=l[n].dataset.xIndex&&a<=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.removeAllButFirst=function(){for(var e=this.getFirst(),t=1;t<l.length;t++)l[t].classList.add("wptb-fused-cell-"+e.dataset.xIndex+"-"+e.dataset.yIndex)},this};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Parser=function(e){var t=document.createElement("div");t.innerHTML=e;for(var a=t.children[0],n=[].concat(_toConsumableArray(a.querySelectorAll(".wptb-column-title-mobile-container"))),l=0;l<n.length;l++){n[l].parentNode.removeChild(n[l])}for(var r=a.querySelectorAll("td"),o=0;o<r.length;o++)r[o].classList.add("wptb-droppable"),r[o].classList.remove("wptb-column-title-mobile-not-elements");return a},WPTB_Parser2=function(e){if(Array.isArray(e)){var t=void 0;if(1==e.length)return t.appendChild(document.createTextNode(e[0]));if(0 in e){var a=e[0];if(t=document.createElement(a),1 in e&&Array.isArray(e[1]))for(var n=e[1],l=0;l<n.length;l++)Array.isArray(n[l])&&t.setAttribute(n[l][0],n[l][1]);if(2 in e)if(Array.isArray(e[2]))for(var r=0;r<e[2].length;r++)"string"!=typeof e[2][r]||"p"!=a.toLowerCase()?WPTB_Parser(e[2][r])&&t.appendChild(WPTB_Parser(e[2][r])):t.appendChild(document.createTextNode(e[2][r]));else"string"==typeof e[2]&&t.appendChild(document.createTextNode(e[2]))}return t}return!1},WPTB_Settings=function(){for(var e=document.getElementsByClassName("wptb-element"),t=0;t<e.length;t++)e[t].ondragstart=function(e){e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("wptbElement",e.target.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+e.target.dataset.wptbElement,"wptbElIndic-"+e.target.dataset.wptbElement)},e[t].ondragend=function(){var e=document.querySelector(".wptb-drop-handle"),t=document.querySelector(".wptb-border-marker");(e||t)&&(e.style.display="none",t.style.display="none")};var a=document.getElementsByClassName("wptb-popup-window-modal")[0];document.getElementsByClassName("wptb-embed-btn")[0].onclick=function(){this.classList.contains("wptb-button-disable")||a.classList.add("wptb-popup-show")},document.getElementsByClassName("wptb-popup-dark-area")[0].onclick=function(){a.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-popup-window-close-icon")[0].onclick=function(){a.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-preview-btn")[0].onclick=function(e){this.classList.contains("wptb-button-disable")&&e.preventDefault()},document.getElementsByClassName("wptb-save-btn")[0].onclick=function(){var e=document.querySelector(".wptb-edit-bar");e&&e.classList.contains("visible")&&document.getElementsByClassName("wptb-preview-table")[0].toggleTableEditMode();var l=new XMLHttpRequest,t=(wptb_admin_object?wptb_admin_object.ajaxurl:ajaxurl)+"?action=save_table",r=document.getElementById("wptb-setup-name").value.trim(),o=void 0,a=document.getElementsByClassName("wptb-preview-table");if(a=0<a.length?(a=WPTB_Stringifier(a[0])).outerHTML:"",""===r||""===a){var n="";return""===r&&(n+="You must assign a name to the table before saving it.</br>"),""===a&&(n+="Table wasn't created"),(o=document.getElementById("wptb-messaging-area")).innerHTML='<div class="wptb-error wptb-message">Error: '+n+"</div>",o.classList.add("wptb-warning"),void setTimeout(function(){o.removeChild(o.firstChild)},4e3)}var i={title:r,content:a,security_code:wptb_admin_object.security_code};((rs=WPTB_Helper.detectMode())||(rs=document.wptbId))&&(i.id=rs),i=JSON.stringify(i),l.open("POST",t,!0),l.setRequestHeader("Content-type","application/json; charset=utf-8"),l.onreadystatechange=function(e){if(4==this.readyState&&200==this.status){var t=JSON.parse(l.responseText);if(o=document.getElementById("wptb-messaging-area"),"saved"==t[0]){document.wptbId=t[1],o.innerHTML='<div class="wptb-success wptb-message">Table "'+r+'" was successfully saved.</div>',document.getElementsByClassName("wptb-embed-btn")[0].classList.remove("wptb-button-disable"),document.getElementById("wptb-embed-shortcode").value="[wptb id="+t[1]+"]";var a=document.getElementsByClassName("wptb-preview-btn");if(0<a.length){(a=a[0]).classList.remove("wptb-button-disable");var n=a.dataset.previewHref;n=n.replace("empty",t[1]),a.setAttribute("href",n)}}else"edited"==t[0]?o.innerHTML='<div class="wptb-success wptb-message">Table "'+r+'" was successfully updated.</div>':o.innerHTML='<div class="wptb-error wptb-message">Safety problems</div>';o.classList.add("wptb-success"),setTimeout(function(){o.removeChild(o.firstChild)},4e3)}},l.send(i)}},WPTB_Space=function i(e){var t=void 0;if(e?t=e:(t=document.createElement("div")).classList.add("wptb-space-between"),t.ondragenter=function(){this.classList.add("visible")},t.ondragover=function(e){e.preventDefault()},t.ondragleave=function(){this.classList.remove("visible")},t.ondrop=function(e){e.stopPropagation();for(var t,a,n,l,r=e.target.nextSibling,o=e.target;!o.classList.contains("wptb-droppable");)o=o.parentNode;e.dataTransfer.getData("wptbElement")?(t=(l=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:l.includes("image")?new WPTB_Image:l.includes("text")?new WPTB_Text:l.includes("button")?new WPTB_Button:void 0,this.classList.remove("visible"),null==r?(o.appendChild(t.getDOMElement()),o.appendChild(new i)):(o.insertBefore(t.getDOMElement(),r),o.insertBefore(new i,r))):(alert(e.dataTransfer.getData("node")),a=(t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).nextSibling,n=t.parentNode,null!=a&&n.removeChild(a),null==r?(o.appendChild(t),o.appendChild(new i)):(o.insertBefore(t,r),o.insertBefore(new i,r))),this.classList.remove("visible")},!e)return t},WPTB_Stringifier=function(e){if(e){var t=e.cloneNode(!0);t.classList.add("wptb-table-preview-static-indic"),t.dataset.tableColumns=e.columns,t.style.width=null,t.style.minWidth=null,t.style.maxWidth=null;var a=t.getElementsByTagName("td");if(0<a.length)for(var n=0;n<a.length;n++){e.querySelector("wptb-table-preview-head")&&a[n].removeAttribute("data-x-index"),a[n].removeAttribute("data-y-index"),a[n].removeAttribute("draggable"),a[n].classList.remove("wptb-droppable");var l=a[n].getElementsByClassName("wptb-ph-element");if(0<l.length)for(var r=0;r<l.length;r++){var o=l[r].querySelectorAll(".mce-content-body");if(0<o.length)for(var i=0;i<o.length;i++)o[i].classList.remove("mce-content-body");var s=l[r].querySelectorAll("[data-mce-style]");if(0<s.length)for(var d=0;d<s.length;d++)s[d].removeAttribute("data-mce-style");var c=l[r].querySelectorAll("[contenteditable]");if(0<c.length)for(var p=0;p<c.length;p++)c[p].removeAttribute("contenteditable");var m=l[r].querySelectorAll("[spellcheck]");if(0<m.length)for(var u=0;u<m.length;u++)m[u].removeAttribute("spellcheck");var b=l[r].querySelectorAll("[id^=mce_]");if(0<b.length)for(var g=0;g<b.length;g++)b[g].removeAttribute("id");for(var w=l[r].querySelectorAll(".wptb-actions"),h=w.length;0<h&&w[0]&&w[0].parentNode;)w[0].parentNode.removeChild(w[0]),h--}if(a[n].hasAttribute("data-wptb-title-column")){var y=document.createElement("div"),v=document.createElement("div");y.classList.add("wptb-column-title-mobile-container"),v.classList.add("wptb-column-title-mobile"),v.dataset.wptbTitleColumn=a[n].dataset.wptbTitleColumn,v.setAttribute("style","font-size:"+a[n].dataset.wptbTitleColumnFontSize+"; \n color:"+a[n].dataset.wptbTitleColumnColor+"; background-color:"+a[n].dataset.wptbTitleBackgroundColor+"; text-align:"+a[n].dataset.wptbTitleAlign+";"),v.style.padding=a[n].style.padding,0==a[n].children.length&&a[n].classList.add("wptb-column-title-mobile-not-elements"),y.appendChild(v),a[n].insertBefore(y,a[n].firstChild)}}return t}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Stringifier2=function(e){1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(null==e)return"";if(null==e.tagName&&3==e.nodeType)return e.nodeValue;var t=[],a=void 0,n=!1,l=[].concat(_toConsumableArray(e.attributes)),r=[],o=[];if((e.parentNode.classList.contains("wptb-list-item-content")||e.parentNode.classList.contains("mce-content-body"))&&"p"==e.tagName.toLowerCase()?(a=e.childNodes,n=!0):a=0<e.children.length?e.children:e.childNodes,0<l.length)for(var i=0;i<l.length;i++)r[i]=[l[i].name,l[i].value];else r="";if(0<a.length)for(var s=0;s<a.length;s++){var d=WPTB_Stringifier(a[s]);Array.isArray(d)||n?o[s]=d:"string"==typeof d&&d&&(o=d)}else o="";return t.push(e.tagName.toLowerCase(),r,o),t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},array=[],WPTB_Table=function(e,t){var _,a,n,h,l=document.getElementsByClassName("wptb-settings-items"),f=document.getElementsByClassName("wptb-table-setup")[0],B=function(e){var t,a=this.rowSpan,n=this.colSpan,l=document.getElementsByClassName("wptb-no-cell-action"),r=document.getElementsByClassName("wptb-single-action"),o=document.getElementsByClassName("wptb-multiple-select-action"),i=document.getElementById("wptb-left-scroll-panel-cell-settings"),s=T(this),d=s[0],c=s[1];if(document.select.isActivated()){if(this.className.match(/wptb-highlighted/)){this.classList.remove("wptb-highlighted");for(var p=0;p<a;p++)for(var m=0;m<n;m++)array[d+p][c+m]=0}else{this.classList.add("wptb-highlighted");for(p=0;p<a;p++)for(m=0;m<n;m++)array[d+p][c+m]=1}if(0===(t=document.getElementsByClassName("wptb-highlighted").length)){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.add("visible"),l[p].removeAttribute("disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}else if(1===t){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.add("visible"),r[p].removeAttribute("disabled");var u=document.querySelector(".wptb-highlighted");if(u){var b=document.getElementById("wptb-table-column-width-slider"),g=document.getElementById("wptb-table-column-width-number"),w=document.getElementById("wptb-table-column-width-auto-fixed"),h=u.style.width;if(h)b.value=parseFloat(h,10),g.value=parseFloat(h,10),w.checked=!0;else if(u.dataset.wptbFixedWidth)b.value=u.dataset.wptbFixedWidth,g.value=u.dataset.wptbFixedWidth,w.checked=!0;else{var y=WPTB_Helper.getColumnWidth(_,u);b.value=y,g.value=y,w.checked=!1}var v=document.getElementById("wptb-table-row-height-slider"),f=document.getElementById("wptb-table-row-height-number"),B=document.getElementById("wptb-table-row-height-auto-fixed"),E=u.style.height;if(E)v.value=parseFloat(E,10),f.value=parseFloat(E,10),B.checked=!0;else if(u.dataset.wptbFixedHeight)v.value=u.dataset.wptbFixedHeight,f.value=u.dataset.wptbFixedHeight,B.checked=!0;else{var C=WPTB_Helper.getRowHeight(_,u);v.value=C,f.value=C,B.checked=!1}}i.classList.add("visible")}else{for(p=0;p<o.length;p++)_.isSquare(array)?(o[p].classList.add("visible"),o[p].removeAttribute("disabled")):(o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled"));for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}}},E=function(e){for(var t=0;t<e.length;t++){for(var a=0;a<e[t].length;a++)" "+e[t][a];"\n"}_.isSquare(e)},C=function(){for(var e=document.getElementsByClassName("wptb-no-cell-action"),t=document.getElementsByClassName("wptb-single-action"),a=document.getElementsByClassName("wptb-multiple-select-action"),n=_.getElementsByClassName("wptb-highlighted");n.length;)n[0].classList.remove("wptb-highlighted");for(var l=0;l<array.length;l++)for(var r=0;r<array[l].length;r++)array[l][r]=0;for(l=0;l<a.length;l++)a[l].classList.remove("visible"),a[l].setAttribute("disabled","disabled");for(l=0;l<e.length;l++)e[l].classList.add("visible"),e[l].removeAttribute("disabled");for(l=0;l<t.length;l++)t[l].classList.remove("visible"),t[l].setAttribute("disabled","disabled")},T=function(e){for(var t=[],a=0;a<h;a++)t[a]=0;for(a=0;a<_.rows.length;a++)for(var n=_.rows[a].getElementsByTagName("td"),l=cellPointer=0;l<h;l+=stepsToMove)if(stepsToMove=1,t[l])t[l]--;else{var r=n[cellPointer++];if(r==e)return[a,l];if(1<r.rowSpan){for(var o=0;o<r.colSpan;o++)t[l+o]=r.rowSpan-1;stepsToMove=r.colSpan}else 1<r.colSpan&&(stepsToMove=r.colSpan)}};if(jQuery("#wptb-table-header-bg").val(""),jQuery("#wptb-even-row-bg").val(""),jQuery("#wptb-odd-row-bg").val(""),jQuery("#wptb-table-border-color").val(""),jQuery("#wptb-table-inner-border-number,#wptb-table-inner-border-slider").val("0"),jQuery("#wptb-table-border-number,#wptb-table-border-slider").val("0"),jQuery("#wptb-table-padding-number,#wptb-table-padding-slider").val("15"),e||t){for(var r=0;r<l.length;r++)"wptb-apply-inner-border"!==l[r].id&&l[r].classList.add("visible");(_=document.createElement("table")).classList.add("wptb-preview-table"),_.dataset.reconstraction=1,_.dataset.wptbAdaptiveTable=1;for(r=0;r<t;r++){(a=_.insertRow(-1)).classList.add("wptb-row");for(var g=0;g<e;g++)(n=new WPTB_Cell(B)).setCoords(r,g),a.appendChild(n.getDOMElement())}}else{var o=document.getElementsByClassName("wptb-preview-table");if(0<o.length){var i=(_=o[0]).getElementsByTagName("td");if(0<i.length)for(var s=0;s<i.length;s++)WPTB_Cell(B,i[s])}}_.toggleTableEditMode=function(){var e=document.getElementsByClassName("wptb-edit-bar"),t=document.getElementById("wptb-cell_mode_background"),a=document.getElementById("wptb-left-scroll-panel-curtain"),n=document.getElementById("wptb-left-scroll-panel-cell-settings"),l=document.getElementsByClassName("wptb-preview-table");if(0<l.length&&(l=l[0]),0<e.length)for(var r=0;r<e.length;r++)if(e[r].classList.contains("visible")){document.select.deactivateMultipleSelectMode(),e[r].classList.remove("visible"),t.classList.remove("visible"),a.classList.remove("visible"),n.classList.remove("visible"),l.classList.remove("wptb-preview-table-manage-cells");var o=l.getElementsByTagName("td");if(0<o.length)for(var i=0;i<o.length;i++)o[i].classList.remove("wptb-highlighted")}else document.select.activateMultipleSelectMode(),e[r].classList.add("visible"),t.classList.add("visible"),a.classList.add("visible"),l.classList.add("wptb-preview-table-manage-cells")},_.recalculateIndexes=function(e){for(var t=this.getElementsByTagName("tr"),a=void 0,n=0,l=0,r=[],o=document.getElementById("wptb-top-row-as-header"),i=0;i<t.length;i++){0==i?(null==e&&(t[i].style.backgroundColor=jQuery("#wptb-table-header-bg").val()),o.checked?null==e&&(this.classList.add("wptb-table-preview-head"),t[i].classList.add("wptb-table-head")):null==e&&(this.classList.remove("wptb-table-preview-head"),t[i].classList.remove("wptb-table-head"))):(i%2==0?null==e&&(t[i].style.backgroundColor=jQuery("#wptb-odd-row-bg").val()):null==e&&(t[i].style.backgroundColor=jQuery("#wptb-even-row-bg").val()),t[i].classList.remove("wptb-table-head")),r[i],a=t[i].getElementsByTagName("td"),null==r[i]&&(r[i]=[]);for(var s=0,d=0;d<a.length;d++){if(null!=r[i][d])for(var c=0;c<100;c++){if(null==r[i][s]){r[i][s]=a[d],a[d].dataset.xIndex=s;break}s++}else r[i][d]=a[d],a[d].dataset.xIndex=s;if(a[d].dataset.yIndex=i,1<a[d].colSpan)for(var p=1;p<a[d].colSpan;p++)s++,r[i][s]="tdDummy";if(1<a[d].rowSpan)for(var m=1;m<a[d].rowSpan;m++){null==r[i+m]&&(r[i+m]=[]);for(var u=0;u<a[d].colSpan;u++)r[i+m][s-a[d].colSpan+1+u]="tdDummy"}s++,0==i&&(l=s)}n<d&&(n=d)}this.columns=n,this.maxCols=l},_.addColumnWidth=function(m,u){var e=_.getElementsByClassName("wptb-highlighted");if(0<e.length){for(var t=0;t<e.length;t++){var a=e[t].dataset.xIndex;a&&function e(t,a){for(var n=_.rows,l=!1,r=[],o=0;o<n.length;o++)for(var i=n[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.xIndex==t){if(m)if(d.colSpan==a){d.style.width=m+"px",d.removeAttribute("data-wptb-fixed-width"),l=!0;var c=document.getElementById("wptb-table-column-width-auto-fixed");c.checked||(c.checked=!0)}else d.style.width=null,d.dataset.wptbFixedWidth=m,o!=n.length-1||l||e(t,a+1);else if(u)d.style.width=null,d.removeAttribute("data-wptb-fixed-width");else if(d.dataset.wptbFixedWidth)d.colSpan==a&&(d.style.width=d.dataset.wptbFixedWidth+"px",d.removeAttribute("data-wptb-fixed-width"));else if(d.style.width){for(var p=0;p<r.length;p++)r[p].style.width=d.style.width;r=[]}else r.push(d);break}}}(a,1)}_.tdDefaultWidth()}},_.tdDefaultWidth=function(){for(var e,t=_.rows,a=0,n=0,l=document.getElementsByClassName("wptb-table-setup")[0].offsetWidth,r=[],o=[],i=0,s=0,d="",c=0;c<t.length;c++)for(var p=t[c].children,m=0;m<p.length;m++){var u=p[m];if(r[parseInt(u.dataset.xIndex)]||o[parseInt(u.dataset.xIndex)])o[parseInt(u.dataset.xIndex)]?u.dataset.wptbFixedWidth||(u.dataset.wptbCssTdAutoWidth=!0):r[parseInt(u.dataset.xIndex)]&&u.removeAttribute("data-wptb-css-td-auto-width");else if(u.style.width?(r[parseInt(u.dataset.xIndex)]=parseFloat(u.style.width),u.removeAttribute("data-wptb-css-td-auto-width")):u.dataset.wptbFixedWidth||(o[parseInt(u.dataset.xIndex)]=100,u.dataset.wptbCssTdAutoWidth=!0),window.getComputedStyle(u,null)){var b=window.getComputedStyle(u,null),g=b.getPropertyValue("padding-left"),w=b.getPropertyValue("padding-right");i=parseFloat(g,10)+parseFloat(w,10);var h=b.getPropertyValue("border-left-width"),y=b.getPropertyValue("border-right-width");s=parseFloat(h,10)+parseFloat(y,10),r[parseInt(u.dataset.xIndex)]?(r[parseInt(u.dataset.xIndex)]+=i,r[parseInt(u.dataset.xIndex)]+=s):(o[parseInt(u.dataset.xIndex)]+=i,o[parseInt(u.dataset.xIndex)]+=s)}}for(var v=0;v<r.length;v++)r[v]&&(a+=r[v]);for(var f=0,B=0;B<o.length;B++)o[B]&&(n+=o[B],f++);var E=window.getComputedStyle(_,null),C=E.getPropertyValue("border-left-width"),T=E.getPropertyValue("border-right-width"),x=parseFloat(C,10)+parseFloat(T,10);e=a+n+x,_.dataset.wptbTableTdsSumMaxWidth=e,f?(_.dataset.wptbCellsWidthAutoCount=f,_.mergingСellsHorizontally?_.dataset.wptbFixedWidthSize=a-x:_.removeAttribute("data-wptb-fixed-width-size")):(_.removeAttribute("data-wptb-fixed-width-size"),_.removeAttribute("data-wptb-cells-width-auto-count"));var I=!1,k=void 0;e<l?f?(_.style.minWidth="100%",_.mergingСellsHorizontally?(k=(k=(l-a-x)/f)-i-s,I=!(_.style.width=null)):_.style.width="100%"):(_.style.width=null,_.style.minWidth=null,_.style.maxWidth=e+"px"):(_.style.maxWidth=null,_.style.minWidth=e+"px",k="100",I=!(_.style.width=null));var N=document.head;if(N){var S=N.querySelector('style[data-wptb-td-auto-width="true"]');S&&N.removeChild(S)}I&&((d=document.createElement("style")).setAttribute("data-wptb-td-auto-width",!0),d.innerHTML="[data-wptb-css-td-auto-width=true]{width:"+k+"px}",N&&N.appendChild(d))},_.addRowHeight=function(m,u){var e=_.getElementsByClassName("wptb-highlighted");if(0<e.length)for(var t=0;t<e.length;t++){var a=e[t].dataset.yIndex;a&&function e(t,a){for(var n=_.rows,l=!1,r=[],o=0;o<n.length;o++)for(var i=n[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.yIndex==t)if(m){if(d.rowSpan==a){d.style.height=m+"px",d.removeAttribute("data-wptb-fixed-heidht"),l=!0;var c=document.getElementById("wptb-table-row-height-auto-fixed");c.checked||(c.checked=!0);continue}d.style.height=null,d.dataset.wptbFixedHeight=m,s!=i.length-1||l||e(t,a+1)}else if(u)d.style.height=null,d.removeAttribute("data-wptb-fixed-heidht");else if(d.dataset.wptbFixedHeight)(d.rowSpan=a)&&(d.style.height=d.dataset.wptbFixedHeight+"px",d.removeAttribute("data-wptb-fixed-width"));else if(d.style.height){for(var p=0;p<r.length;p++)r[p].style.height=d.style.height;r=[]}else r.push(d)}}(a,1)}},_.reconstraction=function(){var e=_.getElementsByTagName("td"),t=document.getElementsByClassName("wptb-adaptive-table-chose-block");0<t.length&&(t=t[0]),_.mergingСellsHorizontally=!1,_.mergingCellsVertically=!1,_.dataset.reconstraction=1,t.style.display="block";for(var a=0,n=0;n<e.length&&(1<e[n].colSpan&&(_.dataset.reconstraction=0,t.style.display="none",_.mergingСellsHorizontally=!0,a++),1<e[n].rowSpan&&(_.dataset.reconstraction=0,t.style.display="none",_.mergingCellsVertically=!0,a++),2!=a);n++);},_.addColumnEnd=function(){var e=void 0,t=document.getElementsByClassName("wptb-preview-table"),a=void 0,n=void 0;0<t.length&&(a=t[0].querySelector("td")),a&&(n=a.getAttribute("style"));for(var l=0;l<_.rows.length;l++)e=new WPTB_Cell(B),n&&(e.getDOMElement().setAttribute("style",n),e.getDOMElement().style.width=null),_.rows[l].appendChild(e.getDOMElement()),array[l].push(0);h++,_.recalculateIndexes(),_.tdDefaultWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addColumnStart=function(){var e=void 0,t=void 0,a=document.getElementsByClassName("wptb-preview-table"),n=void 0,l=void 0;0<a.length&&(n=a[0].querySelector("td")),n&&(l=n.getAttribute("style"));for(var r=0;r<_.rows.length;r++)e=new WPTB_Cell(B),l&&(e.getDOMElement().setAttribute("style",l),e.getDOMElement().style.width=null),(t=_.rows[r].getElementsByTagName("td")[0])?_.rows[r].insertBefore(e.getDOMElement(),t):_.rows[r].appendChild(e.getDOMElement()),array[r].push(0);h++,_.recalculateIndexes(),_.tdDefaultWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addColumnAfter=function(e){var t=_.rows,a=void 0,n=void 0,l=document.querySelector(".wptb-highlighted"),r=l.getAttribute("style"),o=null!=e&&"number"==typeof e?e:T(l)[1];if(h-o-l.colSpan+1==1)_.addColumnEnd();else{for(var i=!1,s=void 0,d=void 0,c=void 0,p=[],m=void 0,u=0;u<h;u++)p.push(0);for(u=0;u<t.length;u++){a=0,n=t[u].getElementsByTagName("td"),i=!1;for(var b=0;b<h;b+=s){if(s=1,i){d=new WPTB_Cell(B),r&&(d.getDOMElement().setAttribute("style",r),d.getDOMElement().style.width=null),m&&t[u].contains(m)?(c=m.nextSibling)?t[u].insertBefore(d.getDOMElement(),c):t[u].appendChild(d.getDOMElement()):t[u].insertBefore(d.getDOMElement(),n[0]);break}if(0<p[b])o==b&&(i=!0);else if(1<(m=n[a++]).rowSpan){s=m.colSpan;for(var g=0;g<m.colSpan;g++)p[b+g]=m.rowSpan,b+g==o&&(i=!0)}else if(1<m.colSpan){s=m.colSpan;for(g=0;g<m.colSpan;g++)b+g==o&&(i=!0)}else b==o&&(i=!0)}for(var w=0;w<h;w++)0<p[w]&&p[w]--}for(u=0;u<array.length;u++)array[u].push(0);h++,E(array),_.recalculateIndexes(),_.addColumnWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C()}},_.addColumnBefore=function(){var e=document.querySelector(".wptb-highlighted"),t=T(e)[1];0===t?_.addColumnStart():_.addColumnAfter(t-1)},_.addRowToTheEnd=function(){var e,t=_.insertRow(-1),a=void 0,n=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<n.length&&(l=n[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<h;o++)a=new WPTB_Cell(B),r&&a.getDOMElement().setAttribute("style",r),t.appendChild(a.getDOMElement());e=Array.from(array[0]),array.push(e),E(array),_.recalculateIndexes(),_.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addRowToTheStart=function(){var e,t=_.insertRow(0),a=void 0,n=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<n.length&&(l=n[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<h;o++)a=new WPTB_Cell(B),r&&a.getDOMElement().setAttribute("style",r),t.appendChild(a.getDOMElement());e=Array.from(array[0]),array.push(e),E(array),_.recalculateIndexes(),_.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(_),C()},_.addRowBefore=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=T(e)[0],n=void 0,l=a-1;0<=l;l--){var r=_.rows[l].children,o=r.length;if(0<o)for(var i=0;i<o;i++)if(1==r[i].rowSpan){a=l,n=!0;break}if(n)break}0===a?_.addRowToTheStart():_.addRowAfter(a,t)},_.addRowAfter=function(e,t){var a,n=void 0;if(null!=e&&"number"==typeof e||null!=t)n=e;else{var l=document.querySelector(".wptb-highlighted");t=l.getAttribute("style"),n=(e=T(l)[0])+l.rowSpan-1}var r=0;if(n<_.rows.length-1){for(var o=0;o<=n;o++){var i=_.rows[o].children,s=i.length;if(0<s)for(var d=0;d<s;d++){n<i[d].rowSpan-1+o&&i[d].rowSpan++}}var c=_.rows[n+1].children,p=c.length;if(0<p)for(var m=0;m<p;m++)r+=c[m].colSpan}else r=array[0].length;var u=_.insertRow(n+1);for(u.classList.add("wptb-row"),g=0;g<r;g++){var b=new WPTB_Cell(B);b.getDOMElement().setAttribute("style",t),b.getDOMElement().style.width=null,b.getDOMElement().style.height=null,u.appendChild(b.getDOMElement())}a=Array.from(array[0]),array.push(a),E(array),_.recalculateIndexes(),_.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(_),C()},_.isSquare=function(e){for(var t,a,n=-1,l=-1,r=-1,o=-1,i=0,s=0;s<e.length;s++)for(var d=0;d<e[s].length;d++)1==e[s][d]&&((d<l||-1==l)&&(l=d),(s<n||-1==n)&&(n=s));for(s=e.length-1;-1<s;s--)for(d=e[s].length-1;-1<d;d--)1==e[s][d]&&(o<d&&(o=d),r<s&&(r=s));for(s=n;s<r;s++)for(d=l;d<o;d++)if(0==e[s][d]||null==e[s][d])return!1;for(s=0;s<e.length;s++)for(d=0;d<e[s].length;d++)1==e[s][d]&&i++;return(t=r-n+1)*(a=o-l+1)===i&&[t,a]},_.mergeCells=function(){for(var e=_.isSquare(array),t=e[0],a=e[1],n=document.querySelector(".wptb-highlighted"),l=[].slice.call(document.getElementsByClassName("wptb-highlighted"),1),r=[],o=0;o<l.length;o++){var i=l[o].getElementsByClassName("wptb-ph-element");if(0<i.length)for(var s=i.length,d=0;d<s;d++)r.push(i[d]);l[o].parentNode.removeChild(l[o])}if(0<r.length)for(var c=0;c<r.length;c++)n.appendChild(r[c]);n.colSpan=a,n.rowSpan=t,_.recalculateIndexes(),_.reconstraction();var p=n.style.width,m=n.dataset.wptbFixedWidth;p?_.addColumnWidth(parseFloat(p,10)):m?_.addColumnWidth():_.addColumnWidth(!1,!0);var u=n.style.height,b=n.dataset.wptbFixedHeight;u?_.addRowHeight(parseFloat(u,10)):b?_.addRowHeight():_.addRowHeight(!1,!0),WPTB_Helper.dataTitleColumnSet(_),C()},_.splitCell=function(){var e=document.getElementsByClassName("wptb-highlighted")[0],t=e.rowSpan,a=e.colSpan,n=e.getAttribute("style"),l=T(e)[0],r=_.rows[l],o=e.dataset.xIndex;e.rowSpan=1;for(var i=e.colSpan=1;i<a;i++){var s=new WPTB_Cell(B);s.getDOMElement().setAttribute("style",n),s.getDOMElement().classList.add("wptb-highlighted"),e.nextSibling?r.insertBefore(s.getDOMElement(),e.nextSibling):r.appendChild(s.getDOMElement())}if(1<t)for(var d=1;d<t;d++){var c=void 0,p=_.rows[l+d],m=p.children,u=m.length;if(0<u)for(var b=0;b<u;b++)if(Number(m[b].dataset.xIndex)>Number(o)){c=m[b];break}for(var g=0;g<a;g++){var w=new WPTB_Cell(B);w.getDOMElement().setAttribute("style",n),null!=c?p.insertBefore(w.getDOMElement(),c):p.appendChild(w.getDOMElement())}}_.recalculateIndexes(),_.reconstraction(),_.addColumnWidth(),_.addRowHeight(),WPTB_Helper.dataTitleColumnSet(_),C();var h=document.getElementById("wptb-left-scroll-panel-cell-settings");h&&h.classList.remove("visible")},_.findRowspannedCells=function(e){var t,a=[];if(actualPoints=function(e){for(var t=_.rows[e].getElementsByTagName("td"),a=0,n=0;n<t.length;n++)a+=t[n].colSpan;return a}(e),actualPoints===h)return[];t=h-actualPoints;for(var n=e-1;0<=n&&t;n--){var l=_.rows[n].getElementsByTagName("td");for(n=0;n<l.length;n++)1<l[n].rowSpan&&(a.push(l[n]),t-=l[n].colSpan)}return a},_.addLackingCells=function(){for(var e=[],t=0;t<_.rows.length;t++)e.push(0);for(t=0;t<_.rows.length;t++)for(var a=_.rows[t].getElementsByTagName("td"),n=0;n<a.length;n++)if(1<a[n].rowSpan)for(var l=1;l<a[n].rowSpan;l++)e[t+l]++;for(t=0;t<_.rows.length;t++){a=_.rows[t].getElementsByTagName("td");var r=0;for(n=0;n<a.length;n++)r+=a[n].colSpan;r+=e[t],difference=h-r;for(n=0;n<difference;n++){var o=new WPTB_Cell(B);_.rows[t].appendChild(o.getDOMElement())}}},_.deleteRow=function(){var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=e.rowSpan,n=T(e)[0],l=void 0;null==a&&(a=1);for(var r=0;r<a;r++){var o=_.rows[n].children,i=_.rows[n+1],s=void 0,d=void 0,c=[];if(null!=i){d=(s=i.children).length;for(var p=0;p<o.length;p++)if(1<o[p].rowSpan){var m=new WPTB_Cell(B);m.getDOMElement().setAttribute("style",t),m.getDOMElement().colSpan=o[p].colSpan,m.getDOMElement().rowSpan=o[p].rowSpan-1;for(var u=void 0,b=0;b<d;b++)if(Number(s[b].dataset.xIndex)>Number(o[p].dataset.xIndex)){u=s[b];break}u?c.push([m,u]):c.push([m])}if(0<c.length)for(var g=0;g<c.length;g++)null!=c[g][1]?i.insertBefore(c[g][0].getDOMElement(),c[g][1]):i.appendChild(c[g][0].getDOMElement())}var w=_.rows;if(0<w.length)for(var h=0;h<n;h++){var y=w[h].children;if(0<y.length)for(var v=0;v<y.length;v++)y[v].rowSpan-1>=n-h&&y[v].rowSpan--}l=Array.from(array[0]),array.pop(l),E(array),_.getElementsByTagName("tbody")[0].removeChild(_.rows[n]),0==_.rows.length&&(_.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),_.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(_)}C()},_.deleteColumn=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.dataset.xIndex,a=e.colSpan,n=0;n<a;n++){for(var l=0;l<_.rows.length;l++){var r=_.rows[l].children,o=r.length;if(0<o)for(var i=o-1;0<=i;i--){if(Number(r[i].dataset.xIndex)==Number(t)){1<r[i].colSpan?r[i].colSpan--:_.rows[l].removeChild(r[i]);break}if(Number(r[i].dataset.xIndex)<Number(t)&&Number(r[i].dataset.xIndex)+Number(r[i].colSpan-1)>=t){1<r[i].colSpan&&r[i].colSpan--;break}}}for(var s=0;s<_.rows.length;s++)null!=array[s]&&array[s].pop();h--,0==_.querySelectorAll("td").length&&(_.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),_.recalculateIndexes(),_.tdDefaultWidth(),WPTB_Helper.dataTitleColumnSet(_)}C()},document.getElementsByClassName("wptb-table-generator")[0].style.display="none",array=function(){for(var e=[],t=[],a=0;a<_.rows.length;a++){for(var n=_.rows[a].getElementsByTagName("td"),l=0,r=0;r<n.length;r++)l+=n[r].colSpan;e.push(l)}h=Math.max.apply(null,e);var o=_.rows.length;for(a=0;a<o;a++)for(t[a]=[],r=0;r<h;r++)t[a].push(0);return E(t),t}(),C(),E(array),f.appendChild(_),_.recalculateIndexes(!0),_.reconstraction(),_.tdDefaultWidth(),f.onresize=function(){_.tdDefaultWidth()},WPTB_LeftPanel()},WPTB_TableStateSaving=function(){var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,t=document.querySelector(".wptb-preview-table");new e(function(e){e.forEach(function(e){})}).observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0})};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Text=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("p"),r=void 0,o=!1;if(a.classList.add("wptb-text-container"),l.innerHTML=null!=e?e:"Text",n.appendChild(l),a.appendChild(n),t){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(var s=[].concat(_toConsumableArray(t.attributes)),d=0;d<s.length;d++)a.setAttribute(s[d].name,s[d].value)}return this.kind="text",this.getDOMElement=function(){return a},applyGenericItemSettings(this,r,o),this},WPTB_innerElementSet=function p(t){t.ondragenter=function(e){-1==e.dataTransfer.types.indexOf("wptbelement")&&-1==e.dataTransfer.types.indexOf("wptb-moving-mode")||(WPTB_DropHandle(this,e),t.classList.add("wptb-ondragenter"))},t.ondragover=function(e){e.preventDefault(),WPTB_DropHandle(this,e)},t.ondragleave=function(){},t.ondrop=function(e){var t=void 0,a=void 0;if(e.preventDefault(),e.stopPropagation(),e.dataTransfer.getData("wptbElement")||e.dataTransfer.getData("node")){var n,l=void 0,r=new WPTB_BorderMarkerActionsField;if(0<document.getElementsByClassName("wptb-drop-handle").length&&(l=document.getElementsByClassName("wptb-drop-handle")[0]),e.dataTransfer.getData("wptbElement")?t=(t="list"==(n=e.dataTransfer.getData("wptbElement"))?new WPTB_List:"image"==n?new WPTB_Image:"text"==n?new WPTB_Text:"button"==n?new WPTB_Button:void 0).getDOMElement():(a=e.dataTransfer.getData("node"),(t=document.getElementsByClassName(a)[0]).classList.remove("wptb-moving-mode"),l.classList.remove("wptb-moving-into-same-elem"),r.wptbBorderMarker.classList.remove("wptb-moving-into-same-elem")),t.classList.remove("wptb-ondragenter"),"block"==l.style.display){var o=void 0;if("Drop Here"==l.dataset.text)(o=l.getDOMParentElement()).appendChild(t);else{var i=l.getDOMParentElement();if(o=i.parentNode,"Above Element"==l.dataset.text)o.insertBefore(t,i);else if("Below Element"==l.dataset.text){var s=i.nextSibling;o.insertBefore(t,s)}}var d=o.parentNode;if(d.classList.contains("wptb-table-head")){var c=WPTB_Helper.findAncestor(d,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(c)}return l.style.display="none",r.borderMarkerHide(),p(t),!0}}},t.mouseenter=function(e){t.classList.remove("wptb-ondragenter")}},applyGenericItemSettings=function(r,e){var t,o,a=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=r.getDOMElement();if(null==e||1==a){t=document.counter.nextIndex(r.kind);for(var n=document.getElementsByClassName("wptb-ph-element"),l=[],s=0;s<n.length;s++){var d=new RegExp("wptb-element-"+r.kind+"-(\\d+)","i"),c=n[s].className.match(d);c&&l.push(c[1])}if(0<l.length)t=Math.max.apply(Math,l)+1;else t=1}else e&&!a&&(t=e.split("-")[1]);i.onmouseenter=function(e){var t=new WPTB_BorderMarkerActionsField;if(t.addActionField(1,i),t.setParameters(this),"button"===r.kind){var a=i.querySelector("a"),n=a.querySelector("div");a.onclick=function(e){e.preventDefault()},WPTB_Helper.buttonsTinyMceInit(n)}else if("text"===r.kind)tinyMCE.init({target:i.childNodes[0],inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("change",function(e){var t=WPTB_Helper.findAncestor(i,"wptb-row");if(t.classList.contains("wptb-table-head")){var a=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(a)}}),e.on("keydown",function(e){new WPTB_BorderMarkerActionsField(1,i).setParameters(i)}),e.on("keyup",function(e){new WPTB_BorderMarkerActionsField(1,i).setParameters(i)})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}});else{o=i.getElementsByClassName("wptb-list-item-content");for(var l=0;l<o.length;l++)WPTB_Helper.listItemsTinyMceInit(o[l])}},i.onmouseleave=function(e){var t=new WPTB_BorderMarkerActionsField;t.wptbActions&&"1"!=t.wptbActions.type||t.leaveFromField(e,i,1)};var p=document.getElementsByClassName("wptb-actions");if(0<p.length&&(p=p[0]),"text"==r.kind){new MutationObserver(function(e){var t=WPTB_Helper.findAncestor(i,"wptb-row");if(t.classList.contains("wptb-table-head")){var a=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(a)}}).observe(r.getDOMElement(),{attributes:!0,attributeFilter:["style"]})}var m=i.className.match(/wptb-element-(.+)-(\d+)/i);m&&i.classList.remove(m[0]),i.classList.contains("wptb-ph-element")||i.classList.add("wptb-ph-element"),i.classList.contains("wptb-element-"+r.kind+"-"+t)||i.classList.add("wptb-element-"+r.kind+"-"+t),new WPTB_ElementOptions(r,t,e),document.counter.increment(r.kind)};
|
1 |
+
var WPTB_ActionsField=function p(){var m=this;this.wptbActions,0!=document.getElementsByClassName("wptb-actions").length&&(this.wptbActions=document.getElementsByClassName("wptb-actions")[0]),this.addActionField=function(e,i){var t=document.getElementsByTagName("body")[0],a=document.getElementsByClassName("wptb-actions");if(0!=a.length){var n=a[0].activeElem;for(n&&n.classList.remove("wptb-directlyhovered");0!=a.length;)a[0].parentNode.removeChild(a[0])}if(1==e){var l=void 0,r=void 0,o=void 0;l=document.createElement("span"),r=document.createElement("span"),o=document.createElement("span"),(a=document.createElement("div")).classList.add("wptb-actions"),l.classList.add("dashicons","dashicons-trash","wptb-delete-action"),r.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),o.classList.add("dashicons","dashicons-move","wptb-move-action"),o.draggable=!0,a.appendChild(o),a.appendChild(r),a.appendChild(l),t.appendChild(a),a.activeElem=i,a.type=1,l.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;if(a.removeChild(t),"text"==t.kind){var n=a.parentNode;if(n.classList.contains("wptb-table-head")){var l=WPTB_Helper.findAncestor(n,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(l)}}(new p).actionsRemove(),(new WPTB_TableStateSaveManager).tableStateSet()},r.onclick=function(e){var t,a=void 0,n=e.target.parentNode.activeElem,l=n.cloneNode(!0);l.classList.remove("wptb-directlyhovered"),t=n.className.match(/wptb-element-(.+)-(\d+)/i)[1];var r=n.parentNode;if("list"==t){for(var o=[],i=n.querySelectorAll("ul li .wptb-list-item-content"),s=0;s<i.length;s++)o.push(i[s].innerHTML);a=new WPTB_List(o,l),r.insertBefore(a.getDOMElement(),n.nextSibling)}else if("text"==t)a=new WPTB_Text(l.childNodes[0].innerHTML,l),r.insertBefore(a.getDOMElement(),n.nextSibling);else if("image"==t)a=new WPTB_Image("",n),r.insertBefore(a.getDOMElement(),n.nextSibling);else{var d=l.childNodes[0].querySelector("p").innerHTML;a=new WPTB_Button(d,l),r.insertBefore(a.getDOMElement(),n.nextSibling)}WPTB_innerElementSet(a.getDOMElement()),new p(1,n).setParameters(n),(new WPTB_TableStateSaveManager).tableStateSet()},o.ondragstart=function(e){var t,a,n=WPTB_Helper.dragImagesArr(),l=e.target.parentNode.activeElem;a=(t=l.className.match(/wptb-element-(.+)-(\d+)/i))[1],l.classList.add("wptb-moving-mode"),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(n[a],0,0),e.dataTransfer.setData("node","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptb-moving-mode","wptb-element-"+t[1]+"-"+t[2]),e.dataTransfer.setData("wptbElIndic-"+t[1],"wptbElIndic-"+t[1]);var r=e.target.parentNode.activeElem;if("text"==r.kind){var o=r.parentNode.parentNode;if(o.classList.contains("wptb-table-head")){var i=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(i)}}m.actionsHide()},a.style.display="block",m.wptbActions=a}else if(2==e){var s=void 0,d=void 0;s=document.createElement("span"),d=document.createElement("span"),(a=document.createElement("span")).classList.add("wptb-actions"),s.classList.add("dashicons","dashicons-trash","wptb-delete-action"),d.classList.add("dashicons","dashicons-admin-page","wptb-duplicate-action"),a.append(d,s),t.appendChild(a),a.activeElem=i;var c=WPTB_Helper.findAncestor(i,"wptb-directlyhovered");c&&c.classList.remove("wptb-directlyhovered"),a.type=2,s.onclick=function(e){var t=e.target.parentNode.activeElem,a=t.parentNode;new p(4).actionsRemove(),a.removeChild(t),WPTB_Helper.listItemsRecalculateIndex(a),(new WPTB_TableStateSaveManager).tableStateSet()},d.onclick=function(e){var t=i.getBoundingClientRect(),a=t.top,n=e.target.parentNode.activeElem,l=n.querySelector(".wptb-list-item-content").innerHTML,r=new WPTB_ListItem(l,n,!0);n.parentNode.insertBefore(r.getDOMElement(),i.nextSibling),WPTB_Helper.listItemsTinyMceInit(r.getDOMElement().firstChild);var o=i.getElementsByClassName("wptb-list-item-content");(0<o.length&&(o=o[0]),setTimeout(function(){o.innerHTML=l,WPTB_Helper.listItemsRecalculateIndex(n.parentNode)},5),a!=(t=i.getBoundingClientRect()).top)&&new p(2,i).setParameters(i);(new WPTB_TableStateSaveManager).tableStateSet()},a.style.display="block",m.wptbActions=a}},this.setParameters=function(t){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.display="block");var a=t.getBoundingClientRect(),n=document.getElementsByClassName("wptb-container")[0],l=function(){var e=t.getBoundingClientRect();m.wptbActions.style.top=parseFloat(e.top)-15+"px"};n.removeEventListener("scroll",l,!1),m.wptbActions.style.top=parseFloat(a.top)-15+"px",m.wptbActions.style.left=parseFloat(a.right)-parseFloat(m.wptbActions.clientWidth)+1+"px",m.wptbActions.style.display="block",t.classList.add("wptb-directlyhovered"),n.addEventListener("scroll",l,!1)},this.leaveFromField=function(e,t,a){if(e.relatedTarget&&(e.relatedTarget.classList.contains("wptb-actions")||e.relatedTarget.classList.contains("wptb-move-action")||e.relatedTarget.classList.contains("wptb-duplicate-action")||e.relatedTarget.classList.contains("wptb-delete-action")))return m.wptbActions||(m.wptbActions=document.getElementsByClassName("wptb-actions")[0]),void(m.wptbActions.onmouseleave=function(e){if(null!=e.relatedTarget&&e.relatedTarget!=m.wptbActions.activeElem&&WPTB_Helper.findAncestor(e.relatedTarget,"wptb-directlyhovered")!=m.wptbActions.activeElem&&(e.target.activeElem.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type)){var t=new p;t.addActionField(1,e.relatedTarget.parentNode.parentNode),t.setParameters(e.relatedTarget.parentNode.parentNode)}});t.classList.remove("wptb-directlyhovered"),m.wptbActions.style.display="none",2==m.wptbActions.type&&e.relatedTarget&&"ul"==e.relatedTarget.localName&&(m.addActionField(1,e.relatedTarget.parentNode),m.setParameters(e.relatedTarget.parentNode))},this.actionsRemove=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&m.wptbActions.parentNode.removeChild(m.wptbActions)},this.actionsHide=function(){if(!m.wptbActions){var e=document.getElementsByClassName("wptb-actions");0<e.length&&(m.wptbActions=e[0])}m.wptbActions&&(m.wptbActions.style.opacity=0)}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}document.addEventListener("DOMContentLoaded",function(){var e=WPTB_Helper.detectMode();if(e){var a=new XMLHttpRequest,t=ajaxurl+"?action=get_table&id="+e;a.open("GET",t,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(e){if(4!=this.readyState||200!=this.status);else{var t=JSON.parse(a.responseText);document.getElementById("wptb-setup-name").value=t[0],t[1]?(document.getElementsByClassName("wptb-table-generator")[0].style.display="none",document.getElementsByClassName("wptb-table-setup")[0].appendChild(WPTB_Parser(t[1])),WPTB_Table(),WPTB_LeftPanel(),WPTB_Settings(),(new WPTB_TableStateSaveManager).tableStateSet()):document.getElementsByClassName("wptb-table-generator")[0].style.display="table"}},a.send(null)}else document.getElementsByClassName("wptb-table-generator")[0].style.display="table";document.counter=new ElementCounters,document.select=new MultipleSelect,WPTB_Initializer(),settings=WPTB_Settings()});var WPTB_Button=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("a"),r=document.createElement("div"),o=document.createElement("p"),i=void 0,s=!1;if(a.classList.add("wptb-button-container","wptb-size-M","wptb-"),n.classList.add("wptb-button-wrapper"),r.classList.add("wptb-button"),o.innerHTML=null!=e?e:"Button Text",t){var d=t.className.match(/wptb-element-((.+-)\d+)/i);d&&Array.isArray(d)&&(i=d[1],s=!0);var c=[].concat(_toConsumableArray(t.attributes));if(0<c.length)for(var p=0;p<c.length;p++)a.setAttribute(c[p].name,c[p].value);var m=t.querySelector(".wptb-button-wrapper");if(m){var u=[].concat(_toConsumableArray(m.attributes));if(0<u.length)for(var b=0;b<u.length;b++)"style"==u[b].name&&n.setAttribute(u[b].name,u[b].value)}var g=t.querySelector("a");if(g)if(0<(h=[].concat(_toConsumableArray(g.attributes))).length)for(var w=0;w<h.length;w++)"style"!=h[w].name&&"href"!=h[w].name&&"target"!=h[w].name||l.setAttribute(h[w].name,h[w].value);var h,v=t.querySelector(".wptb-button");if(v)if(0<(h=[].concat(_toConsumableArray(v.attributes))).length)for(var y=0;y<h.length;y++)"style"==h[y].name&&r.setAttribute(h[y].name,h[y].value)}return n.appendChild(l),l.appendChild(r),r.appendChild(o),a.appendChild(n),this.kind="button",this.getDOMElement=function(){return a},applyGenericItemSettings(this,i,s),this},WPTB_Cell=function(e,i){if(!i){(i=document.createElement("td")).style.padding=jQuery("#wptb-table-padding-number").val()+"px";var t=jQuery("#wptb-table-inner-border-number").val();""!=t&&0!=parseInt(t)&&(i.style.border=t+"px solid "+jQuery("#wptb-table-border-color").val()),i.classList.add("wptb-droppable","wptb-cell")}i.draggable=!1,e&&(i.onclick=e),WPTB_innerElementSet(i);var s=i.getElementsByClassName("wptb-ph-element");if(0<s.length)for(var a=function(e){var t=i.getElementsByClassName("wptb-space-between");if(0<t.length)for(var a=0;a<t.length;a++)WPTB_Space(t[a]);s[e].getDOMElement=function(){return s[e]},WPTB_innerElementSet(s[e]);var n=s[e].className.match(/wptb-element-((.+-)\d+)/i);if(n&&Array.isArray(n)){var l=n[1].split("-");if(s[e].kind=l[0],applyGenericItemSettings(s[e],n[1]),"list"==s[e].kind){var r=s[e].getElementsByTagName("li");if(0<r.length)for(var o=0;o<r.length;o++)WPTB_ListItem(void 0,r[o])}}},n=0;n<s.length;n++)a(n);return this.getDOMElement=function(){return i},this.setCoords=function(e,t){var a=this.getDOMElement();a.dataset.yIndex=e,a.dataset.xIndex=t},this.getCoords=function(){var e,t=this.getDOMElement();return e.x=t.dataset.xIndex,e.y=t.dataset.yIndex,e},this.appendElement=function(e){getDOMElement().appendChild(e)},i.getCellDimensions=function(){var e=window.getComputedStyle(this,null),t=e.getPropertyValue("padding-left"),a=e.getPropertyValue("padding-right"),n=e.getPropertyValue("border-left-width"),l=e.getPropertyValue("border-right-width"),r=e.getPropertyValue("padding-top"),o=e.getPropertyValue("padding-bottom"),i=e.getPropertyValue("border-top-width"),s=e.getPropertyValue("border-bottom-width");return{width:parseFloat(this.offsetWidth,10)-parseFloat(t,10)-parseFloat(a,10)-parseFloat(n,10)-parseFloat(l,10),height:parseFloat(this.offsetHeight,10)-parseFloat(r,10)-parseFloat(o,10)-parseFloat(i,10)-parseFloat(s,10)}},this},WPTB_DropHandle=function(s,e){var d=void 0,c=void 0;if(0==document.getElementsByClassName("wptb-drop-handle").length){(d=document.createElement("div")).classList.add("wptb-drop-handle"),(c=document.createElement("div")).classList.add("wptb-drop-border-marker");var t=document.createElement("div"),a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("div");t.classList.add("wptb-drop-border-marker-top"),a.classList.add("wptb-drop-border-marker-right"),n.classList.add("wptb-drop-border-marker-bottom"),l.classList.add("wptb-drop-border-marker-left"),c.appendChild(t),c.appendChild(a),c.appendChild(n),c.appendChild(l);var r=document.getElementsByTagName("body");0<r.length&&(r[0].appendChild(d),r[0].appendChild(c)),d.ondragenter=function(){},d.ondragover=function(e){e.preventDefault()},d.ondragleave=function(){},d.ondrop=function(e){e.preventDefault();var t,a=void 0;e.dataTransfer.getData("wptbElement")?a=(a=(t=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:t.includes("image")?new WPTB_Image:t.includes("text")?new WPTB_Text:t.includes("button")?new WPTB_Button:void 0).getDOMElement():((a=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).classList.remove("wptb-moving-mode"),a.classList.remove("wptb-moving-into-same-elem"),a.wptbMovingMode=1);var n=void 0;if("Drop Here"==d.dataset.text)"td"==(s=d.getDOMParentElement()).nodeName.toLowerCase()&&(n=d.getDOMParentElement()).appendChild(a);else{var l=d.getDOMParentElement();if(n=l.parentNode,"Above Element"==d.dataset.text)n.insertBefore(a,l);else if("Below Element"==d.dataset.text){var r=l.nextSibling;n.insertBefore(a,r)}}var o=n.parentNode;if(o.classList.contains("wptb-table-head")){var i=WPTB_Helper.findAncestor(o,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(i)}(d.style.display="none",c.style.display="none",WPTB_innerElementSet(a),console.log(a),a.classList.contains("wptb-image-container")&&1!=a.wptbMovingMode)||((new WPTB_TableStateSaveManager).tableStateSet(),a.wptbMovingMode)},document.querySelector(".wptb-container").onscroll=function(){d.style.display="none",c.style.display="none"}}else d=document.getElementsByClassName("wptb-drop-handle")[0],c=document.getElementsByClassName("wptb-drop-border-marker")[0];if(!s||"td"!=s.nodeName.toLowerCase()||0==s.getElementsByClassName("wptb-ph-element").length){var o=void 0;if("td"==s.localName?o=s.parentNode:"div"==s.localName&&s.classList.contains("wptb-ph-element")&&(o=s.parentNode.parentNode),o.classList.contains("wptb-table-head")){for(var i=e.dataTransfer.types,p=!1,m=0;m<i.length;m++){var u=i[m].match(/wptbelindic-([a-z]+)/i);if(u&&"text"!=u[1]){p=!0;break}}if(p)return}d.style.width=s.offsetWidth+"px";var b=s.offsetHeight,g=s.getBoundingClientRect(),w=parseFloat(g.left),h=void 0;if(d.style.left=w+"px",-1!=e.dataTransfer.types.indexOf("wptb-moving-mode")){var v=document.getElementsByClassName("wptb-moving-mode")[0];s==v?(d.classList.add("wptb-moving-into-same-elem"),c.classList.add("wptb-moving-into-same-elem")):(d.classList.remove("wptb-moving-into-same-elem"),c.classList.remove("wptb-moving-into-same-elem"))}if(d.getDOMParentElement=function(){return s},d.style.display="block",c.style.display="block","td"!=s.nodeName.toLowerCase()){var y=null==e.offsetY?e.layerY:e.offsetY;h=parseFloat(g.top)-parseFloat(11),d.dataset.text="Above Element",b/2<y&&(h=parseFloat(g.top)+b-1,d.dataset.text="Below Element")}else d.dataset.text="Drop Here",h=parseFloat(g.top)+b/2-5;d.style.top=h+"px",c.style.top=g.top+"px",c.style.left=g.left+"px",wptbDropBorderMarkerTop=c.querySelector(".wptb-drop-border-marker-top"),wptbDropBorderMarkerTop.style.width=parseFloat(s.offsetWidth)-parseFloat(1)+"px",wptbDropBorderMarkerRight=c.querySelector(".wptb-drop-border-marker-right"),wptbDropBorderMarkerRight.style.height=parseFloat(g.bottom)-parseFloat(g.top)-1+"px",wptbDropBorderMarkerRight.style.left=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom=c.querySelector(".wptb-drop-border-marker-bottom"),wptbDropBorderMarkerBottom.style.width=wptbDropBorderMarkerTop.style.width,wptbDropBorderMarkerBottom.style.top=wptbDropBorderMarkerRight.style.height,wptbDropBorderMarkerLeft=c.querySelector(".wptb-drop-border-marker-left"),wptbDropBorderMarkerLeft.style.height=wptbDropBorderMarkerRight.style.height}},ElementCounters=function(){var t=[];return t.text=0,t.image=0,t.list=0,t.button=0,this.increment=function(e){e in t&&t[e]++},this.nextIndex=function(e){if(e in t)return t[e]+1},this},WPTB_ElementOptions=function(e,t,a){var n,l=e.getDOMElement();prop=document.querySelector(".wptb-"+e.kind+"-options-prototype").cloneNode(!0),prop.classList.remove("wptb-"+e.kind+"-options-prototype"),n="wptb-options-"+e.kind+"-"+t;for(var r=prop.getElementsByClassName("wptb-element-property"),o=0;o<r.length;o++)r[o].dataset.element=n;if(prop.classList.add(n),document.getElementById("element-options-group").appendChild(prop),a)if("button"==e.kind){var i=document.getElementsByClassName("wptb-element-"+a)[0],s=void 0,d=void 0,c=void 0,p=void 0;if(i&&(p=i.className.match(/wptb-size-([a-z]+)/i)),p&&Array.isArray(p)){var m=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<m.length;o++)m[o].classList.remove("selected"),m[o].innerHTML==p[1]&&m[o].classList.add("selected")}if(i&&(s=i.getElementsByClassName("wptb-button-wrapper"),d=i.getElementsByTagName("a"),c=i.getElementsByClassName("wptb-button")),s){var u=s[0].style.justifyContent,b=prop.querySelector('select[data-type="button-alignment"]').getElementsByTagName("option"),g=void 0;"flex-start"==u?g="left":"center"!=u&&u?"flex-end"==u&&(g="right"):g="center";for(var w=0;w<b.length;w++)b[w].value==g&&(b[w].selected=!0)}if(0<d.length){var h=d[0].getAttribute("href"),v=d[0].getAttribute("target"),y=d[0].getAttribute("id"),f=prop.querySelector('input[data-type="button-link"]'),B=prop.querySelector('input[data-type="button-link-target"]'),S=B.getAttribute("id"),T=B.parentNode.getElementsByTagName("label")[0],E=prop.querySelector('input[data-type="button-id"]');S=S+"-"+a.split("-")[1],B.setAttribute("id",S),T.setAttribute("for",S),f.value=h,v&&"_blank"==v&&(B.checked=!0),E.value=y}if(c){var C=c[0].style.color,N=c[0].style.backgroundColor,x=prop.querySelector('input[data-type="button-text-color"]'),_=prop.querySelector('input[data-type="button-color"]');x.value=WPTB_Helper.rgbToHex(C),_.value=WPTB_Helper.rgbToHex(N)}}else if("image"==e.kind){var I=document.getElementsByClassName("wptb-element-"+a);if(0<I.length){var P=I[0].getElementsByTagName("a");if(0<P.length){var W=P[0];if(W){var k=void 0;k="none"==W.style.float?"center":W.style.float;for(var A=prop.querySelector('select[data-type="image-alignment"]').getElementsByTagName("option"),L=0;L<A.length;L++)A[L].value==k&&(A[L].selected=!0);W.onclick=function(e){e.preventDefault()};var M=W.getAttribute("href"),D=prop.querySelector('input[data-type="image-link"]');M&&(D.value=M);var H=W.getAttribute("target"),q=prop.querySelector('input[data-type="image-link-target"]'),F=q.getAttribute("id"),O=q.parentNode.getElementsByTagName("label")[0];F=F+"-"+a.split("-")[1],q.setAttribute("id",F),O.setAttribute("for",F),H&&"_blank"==H&&(q.checked=!0);var R=W.style.width;if(R){var z=prop.querySelector('input[type="range"][data-type="image-size"]'),j=prop.querySelector('input[type="number"][data-type="image-size"]');z.value=parseInt(R),j.value=parseInt(R)}var Q=W.getElementsByTagName("img");if(0<Q.length){var V=Q[0].getAttribute("alt");prop.querySelector('input[type="text"][data-type="alternative-text"]').value=V}}}}}else if("text"==e.kind){var G=document.getElementsByClassName("wptb-element-"+a);if(0<G.length){var J=G[0].style.fontSize,U=G[0].style.color,Y=prop.querySelector('input[type="range"][data-type="font-size"]'),X=prop.querySelector('input[type="number"][data-type="font-size"]'),K=prop.querySelector('input[type="text"][data-type="color"]');Y.value=parseInt(J)?parseInt(J):10,X.value=parseInt(J)?parseInt(J):10,K.value=WPTB_Helper.rgbToHex(U)}}else if("list"==e.kind){var $=document.getElementsByClassName("wptb-element-"+a);if(0<$.length){var Z=$[0].querySelector("p").style.color;prop.querySelector('input[type="text"][data-type="list-text-color"]').value=WPTB_Helper.rgbToHex(Z);var ee=$[0].querySelectorAll("li");if(0<ee.length){var te=ee[0].querySelector("p").classList;if(0<te.length){var ae=prop.querySelector('select[data-type="list-class"]');if(ae){ae.value="unordered";for(var ne=ae.parentNode.nextSibling,le=0;le<10&&"1"!=ne.nodeType;le++)ne=ne.nextSibling;if(ne){var re=ne.getAttribute("id");ne.setAttribute("id",re+"-"+a),ne.style.display="flex"}var oe=prop.querySelector('select[data-type="list-style-type"]');oe&&(oe.parentNode.style.display="flex",te.contains("wptb-list-style-type-disc")?oe.value="disc":te.contains("wptb-list-style-type-circle")?oe.value="circle":te.contains("wptb-list-style-type-square")?oe.value="square":te.contains("wptb-list-style-type-none")&&(oe.value="none"))}}}var ie=$[0].getElementsByClassName("wptb-list-item-content");if(0<ie.length){for(var se=[],de=0;de<ie.length;de++){var ce=ie[de].querySelector("p");ce&&(ce.style.textAlign?se.push(ce.style.textAlign):se.push("left"))}var pe=0,me=0,ue=0;if(0<se.length)for(var be=0;be<se.length;be++)se[be]&&("left"==se[be]?pe++:"center"==se[be]?me++:"right"==se[be]&&ue++);var ge=prop.querySelector('select[data-type="list-alignment"]'),we=Math.max(pe,me,ue);pe==we?ge.value="left":me==we?ge.value="center":ue==we&&(ge.value="right")}}}if(l.onclick=function(){var e=this.className.match(/wptb-element-((.+-)\d+)/i),t=".wptb-"+e[2]+"options.wptb-options-"+e[1];document.getElementsByClassName("wptb-elements-container")[0].style.display="none",document.getElementsByClassName("wptb-settings-section")[0].style.display="none",document.getElementById("element-options-group").style.display="block";for(var a=document.getElementById("element-options-group").childNodes,n=0;n<a.length;n++)a[n].style&&(a[n].style.display="none");document.querySelector(t).style.display="block"},"button"==e.kind){var he=prop.getElementsByClassName("wptb-btn-size-btn");for(o=0;o<he.length;o++)he[o].onclick=function(){var e=this.innerHTML,t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0];l.classList.remove("wptb-size-S"),l.classList.remove("wptb-size-M"),l.classList.remove("wptb-size-L"),l.classList.remove("wptb-size-XL"),l.classList.add("wptb-size-"+e);for(var r=this.parentNode.getElementsByClassName("wptb-btn-size-btn"),o=0;o<r.length;o++)r[o].classList.remove("selected");this.classList.add("selected"),(new WPTB_TableStateSaveManager).tableStateSet()}}var ve=prop.getElementsByClassName("wptb-element-property");for(o=0;o<ve.length;o++){if(ve[o].classList.contains("wptb-color-picker")&&jQuery(ve[o]).wpColorPicker({change:function(e,t){var a,n,l,r=e.target;if(n=(a=r.dataset.element.match(/wptb-options-(.+)-(\d+)/i))[1],l=a[2],affectedEl=document.getElementsByClassName("wptb-element-"+n+"-"+l)[0],"button"==n)"button-text-color"==r.dataset.type?affectedEl.getElementsByClassName("wptb-button")[0].style.color=t.color.toString():affectedEl.getElementsByClassName("wptb-button")[0].style.backgroundColor=t.color.toString();else if("list"==n){var o=affectedEl.querySelectorAll("p");if(0<o.length)for(var i=0;i<o.length;i++)o[i].style.color=t.color.toString()}else affectedEl.style.color=t.color.toString();WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)}}),"font-size"===ve[o].dataset.type)ve[o].parentNode.parentNode.getElementsByClassName("wptb-text-font-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-number")[0].onchange(event)};if("image-size"===ve[o].dataset.type)ve[o].parentNode.parentNode.getElementsByClassName("wptb-image-size-slider")[0].oninput=function(){this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].value=this.value,this.parentNode.parentNode.getElementsByClassName("wptb-image-width-number")[0].onchange(event)};ve[o].onchange=function(e){var t=this.dataset.element.match(/wptb-options-(.+)-(\d+)/i),a=t[1],n=t[2],l=document.getElementsByClassName("wptb-element-"+a+"-"+n)[0],r=this.value;switch(this.dataset.type){case"src":l.getElementsByTagName("img")[0].src=this.value;break;case"alternative-text":l.getElementsByTagName("img")[0].alt=this.value;break;case"image-link":l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value);break;case"image-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"image-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"image-size":l.getElementsByTagName("a")[0].style.width=this.value+"%",l.getElementsByTagName("a")[0].style.height="auto",this.parentNode.parentNode.getElementsByClassName("wptb-image-size-slider")[0].value=this.value;break;case"image-alignment":var o="";o="center"==this.value?"none":this.value,l.querySelector(".wptb-image-wrapper a").style.float=o;break;case"font-size":l.style.fontSize=r+"px",this.parentNode.parentNode.getElementsByClassName("wptb-text-font-size-slider")[0].value=this.value;break;case"button-alignment":var i="";i="left"==this.value?"start":"right"==this.value?"flex-end":"center",l.getElementsByClassName("wptb-button-wrapper")[0].style.justifyContent=i;break;case"button-link":this.value?l.getElementsByTagName("a")[0].href=WPTB_Helper.linkHttpCheckChange(this.value):l.getElementsByTagName("a")[0].removeAttribute("href");break;case"button-link-target":1==this.checked?l.getElementsByTagName("a")[0].target="_blank":l.getElementsByTagName("a")[0].target="_self";break;case"button-link-nofollow":1==this.checked?l.getElementsByTagName("a")[0].rel="nofollow":l.getElementsByTagName("a")[0].removeAttribute("rel");break;case"button-id":this.value?l.getElementsByTagName("a")[0].id=this.value:l.getElementsByTagName("a")[0].removeAttribute("id");case"button-color":break;case"list-alignment":for(var s=l.querySelectorAll("li"),d=0;d<s.length;d++){var c=s[d].querySelector("p");c&&(c.style.textAlign=this.value)}break;case"list-class":var p=e.target.parentNode.parentNode.querySelector("[data-type=list-style-type]").parentNode,m=p.parentNode;if("unordered"==r){p.style.display="flex",m.querySelector(".wptb-list-icon-select-label").style.display="flex";var u=l.querySelectorAll("li");for(d=0;d<u.length;d++){var b=u[d].querySelector("p");b.removeAttribute("class"),b.classList.add("wptb-list-style-type-disc")}m.querySelector("[data-type=list-style-type]").value="disc"}else{p.style.display="none",m.querySelector(".wptb-list-icon-select-label").style.display="none";var g=l.querySelectorAll("li");for(d=0;d<g.length;d++){g[d].querySelector("p").removeAttribute("class")}}break;case"list-style-type":for(g=l.querySelectorAll("li"),d=0;d<g.length;d++){var w=g[d].querySelector("p");w.removeAttribute("class"),w.classList.add("wptb-list-style-type-"+r.toLowerCase())}}e.target.classList.contains("wptb-text-font-size-slider")||e.target.classList.contains("wptb-image-size-slider")?e.target.onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()}:(new WPTB_TableStateSaveManager).tableStateSet()}}},WPTB_Helper={hexToRgb:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+parseInt(t[1],16)+","+parseInt(t[2],16)+","+parseInt(t[3],16)+")":null},rgbToHex:function(e){return(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""},getDragImageCustom:function(e){var t=location.protocol+"//"+location.hostname,a=document.createElement("img");return a.src=t+"/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/"+e+".png",a},dragImagesArr:function(){return{text:WPTB_Helper.getDragImageCustom("text"),image:WPTB_Helper.getDragImageCustom("image"),button:WPTB_Helper.getDragImageCustom("button"),list:WPTB_Helper.getDragImageCustom("list")}},listItemsRecalculateIndex:function(e){var t=e.querySelectorAll("p");if(0<t.length)for(var a=0;a<t.length;a++)t[a].dataset.listStyleTypeIndex=Number(a)+1+"."},listItemsTinyMceInit:function(e){tinyMCE.init({target:e,inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("keydown",function(e){var t=e.target.parentNode;if(13==e.keyCode){e.preventDefault();var a=e.target.innerHTML,n=new WPTB_ListItem(a,t,!0);return t.parentNode.insertBefore(n.getDOMElement(),t),WPTB_Helper.listItemsTinyMceInit(n.getDOMElement().firstChild),e.target.querySelector("p").innerText="New List Item",void WPTB_Helper.listItemsRecalculateIndex(t.parentNode)}if("8"==e.keyCode||"46"==e.keyCode){var l=e.target.querySelector("p").innerHTML.replace(/<[^>]+>/g,"");if(""==(l=(l=l.replace(/\s+/g," ").trim()).replace(/ /g,"").trim()))e.preventDefault(),e.target.querySelector("p").innerText="\n";else{var r=WPTB_Helper.getSelectionText();(r=(r=r.replace(/\s+/g," ").trim()).replace(/ /g,"").trim())==l&&(e.preventDefault(),e.target.querySelector("p").innerText="\n")}}var o=e.target.parentNode,i=new WPTB_ActionsField;i.addActionField(2,o),i.setParameters(o)}),e.on("keyup",function(e){var t=e.target.parentNode,a=new WPTB_ActionsField;a.addActionField(2,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},buttonsTinyMceInit:function(n){tinyMCE.init({target:n,inline:!0,plugins:"link",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",toolbar:"bold italic strikethrough",setup:function(e){e.on("keydown",function(e){13==e.keyCode&&e.preventDefault();var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t)}),e.on("keyup",function(e){var t=WPTB_Helper.findAncestor(n,"wptb-button-container"),a=new WPTB_ActionsField;a.addActionField(1,t),a.setParameters(t),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}})},linkHttpCheckChange:function(e){if(e){if(-1!=e.indexOf("http://")||-1!=e.indexOf("https://"))return e;var t=e.split("/"),a=void 0;return Array.isArray(t)&&0<t.length&&(a=t[t.length-1]),document.location.protocol+"//"+a}return""},dataTitleColumnSet:function(e){for(var t=e.rows,a=t[0],n=getComputedStyle(a),l=a.children,r={},o=0;o<l.length;o++){for(var i=l[o].children,s=0;s<i.length;s++){var d=i[s];if(d.classList.contains("wptb-ph-element"))if("text"==d.className.match(/wptb-element-(.+)-(\d+)/i)[1]){var c=d.querySelector("p"),p=c.textContent,m=c.style.textAlign;r[l[o].dataset.xIndex]=[p,d.style.fontSize,d.style.color,n.backgroundColor,m];break}}r[l[o].dataset.xIndex]||(r[l[o].dataset.xIndex]=["","","",n.backgroundColor,""])}for(var u=1;u<t.length;u++)for(var b=t[u].children,g=0;g<b.length;g++)r[b[g].dataset.xIndex]?(b[g].dataset.wptbTitleColumn=r[b[g].dataset.xIndex][0],b[g].dataset.wptbTitleColumnFontSize=r[b[g].dataset.xIndex][1],b[g].dataset.wptbTitleColumnColor=r[b[g].dataset.xIndex][2],b[g].dataset.wptbTitleBackgroundColor=r[b[g].dataset.xIndex][3],b[g].dataset.wptbTitleAlign=r[b[g].dataset.xIndex][4]):(b[g].dataset.wptbTitleColumn="",b[g].dataset.wptbTitleColumnFontSize="",b[g].dataset.wptbTitleColumnColor="",b[g].dataset.wptbTitleBackgroundColor="",b[g].dataset.wptbTitleAlign="")},findAncestor:function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},getSelectionText:function(){return window.getSelection?window.getSelection().toString():document.selection.createRange().text},settingsPanelClear:function(){document.getElementById("wptb-adaptive-table-checkbox").checked=!1,document.getElementById("wptb-top-row-as-header").checked=!1,document.getElementById("wptb-table-border-slider").value=0,document.getElementById("wptb-table-border-number").value=0,document.getElementById("wptb-inner-border-check").checked=!1,document.getElementById("wptb-apply-inner-border").classList.remove("visible"),document.getElementById("wptb-table-inner-border-slider").value=1,document.getElementById("wptb-table-inner-border-number").value=1,WPTB_Helper.wpColorPickerClear("wptb-table-border-color",!0),WPTB_Helper.wpColorPickerClear("wptb-table-header-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-even-row-bg",!0),WPTB_Helper.wpColorPickerClear("wptb-odd-row-bg",!0),document.getElementById("wptb-table-cell-slider").value=15,document.getElementById("wptb-table-cell-number").value=15},elementOptionsPanelClear:function(){var e=document.getElementById("element-options-group");e&&(e.innerHTML="")},wpColorPickerCheckChangeForTableStateSaving:function(e){if("external"==e.originalEvent.type){(new WPTB_TableStateSaveManager).tableStateSet()}else{var t=WPTB_Helper.findAncestor(e.target,"wp-picker-container");if(t)if("square"==e.originalEvent.type){var a=t.getElementsByClassName("iris-square-handle");0<a.length&&((a=a[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}else if("strip"==e.originalEvent.type){var n=t.getElementsByClassName("iris-slider-offset");0<n.length&&((n=n[0]).onmouseup=function(){(new WPTB_TableStateSaveManager).tableStateSet()})}}},wpColorPickerClear:function(e,t){var a=void 0;t?(a=[document.getElementById(e)]).length=1:a=document.getElementsByClassName(e);for(var n=0;n<a.length;n++){var l=WPTB_Helper.findAncestor(a[n],"wp-picker-container");if(l){var r=l.parentNode;r.removeChild(l);var o=document.createElement("input");t?o.setAttribute("id",e):o.classList.add("wptb-element-property",e),o.value="",r.appendChild(o)}}},detectMode:function(){var e=window.location.href,t=new RegExp("[?&]table(=([^&#]*)|&|#|$)").exec(e);return!!t&&(t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"")},getColumnWidth:function(e,t){for(var a=t.dataset.xIndex,n=e.querySelectorAll('[data-x-index="'+a+'"]'),l=t.getCellDimensions().width,r=0;r<n.length;r++)l>n[r].getCellDimensions().width&&(l=n[r].getCellDimensions().width);return l},getRowHeight:function(e,t){for(var a=t.dataset.yIndex,n=e.querySelectorAll('[data-y-index="'+a+'"]'),l=t.getCellDimensions().height,r=0;r<n.length;r++)l>n[r].getCellDimensions().height&&(l=n[r].getCellDimensions().height);return l}},WPTB_Image=function(e,t){var a=void 0,n=void 0,l=void 0,r=!1;if(null==t){a=document.createElement("div"),n=document.createElement("div");var o=document.createElement("a"),i=document.createElement("img");o.style.display="block",o.appendChild(i),a.classList.add("wptb-image-container"),n.classList.add("wptb-image-wrapper"),n.appendChild(o),a.appendChild(n),o.onclick=function(e){e.preventDefault()},file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1}),file_frame.on("select",function(){attachment=file_frame.state().get("selection").first().toJSON();var e=attachment.url.split(":"),t=void 0;Array.isArray(e)&&0<e.length&&(t=e[e.length-1]),i.src=t,i.height=attachment.height,i.width=attachment.width,i.style.width="100%",(new WPTB_TableStateSaveManager).tableStateSet()}),null==e?file_frame.open():i.src=e}else{(a=t.cloneNode(!0)).getElementsByTagName("a")[0].onclick=function(e){e.preventDefault()};var s=t.className.match(/wptb-element-((.+-)\d+)/i);s&&Array.isArray(s)&&(l=s[1],r=!0)}return this.kind="image",this.getDOMElement=function(){return a},applyGenericItemSettings(this,l,r),this},WPTB_Initializer=function(){var e=document.body;columnsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[0],columnsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[0],rowsDecrementButton=e.getElementsByClassName("wptb-input-number-decrement")[1],rowsIncrementButton=e.getElementsByClassName("wptb-input-number-increment")[1],columnsInput=document.getElementById("wptb-columns-number"),rowsInput=document.getElementById("wptb-rows-number"),columnsDecrementButton.onclick=function(){1<columnsInput.value&&columnsInput.value--},columnsIncrementButton.onclick=function(){columnsInput.value<30&&columnsInput.value++},rowsDecrementButton.onclick=function(){1<rowsInput.value&&rowsInput.value--},rowsIncrementButton.onclick=function(){rowsInput.value<30&&rowsInput.value++},document.getElementById("wptb-generate-table").onclick=function(){var e=document.getElementById("wptb-columns-number").value,t=document.getElementById("wptb-rows-number").value;WPTB_Table(e,t),(new WPTB_TableStateSaveManager).tableStateSet()}},WPTB_LeftPanel=function(){var e,t,a,n,r=document.getElementsByClassName("wptb-preview-table")[0],l=document.getElementsByClassName("wptb-element");function o(e,t){if(!(3<t)&&r){var a=r.getElementsByTagName("tr");if(a.length>t){var n=a[t].style.backgroundColor,l=document.getElementById(e);l&&n&&(l.value=WPTB_Helper.rgbToHex(n))}}}function i(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.borderWidth=document.querySelector("#wptb-table-inner-border-number").value+"px",t[a].style.borderStyle="solid"}function s(e){for(var t=r.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.padding=e+"px"}function d(e){r.style.borderWidth=e+"px",r.style.borderStyle="solid"}function c(e,t,a){e.onkeydown=function(){var e=this.value;0==(e=String(e))[0]?this.value="":(e=e.substring(0,t),this.value=e)},e.onkeyup=function(){var e=this.value;e=String(e),a<e&&(this.value=a)}}o("wptb-even-row-bg",1),jQuery("#wptb-even-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=1;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString();console.log(e),console.log(this),WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=1;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-odd-row-bg",2),jQuery("#wptb-odd-row-bg").wpColorPicker({change:function(e,t){for(var a=r.getElementsByTagName("tr"),n=2;n<a.length;n+=2)a[n].style.backgroundColor=t.color.toString();WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){for(var e=r.getElementsByTagName("tr"),t=2;t<e.length;t+=2){e[t].style.backgroundColor="";for(var a=e[t].getElementsByTagName("td"),n=0;n<a.length;n++)a[n].style.backgroundColor=""}(new WPTB_TableStateSaveManager).tableStateSet()}}),o("wptb-table-header-bg",0),jQuery("#wptb-table-header-bg").wpColorPicker({change:function(e,t){r.getElementsByTagName("tr")[0].style.backgroundColor=t.color.toString(),(new WPTB_TableStateSaveManager).tableStateSet()},clear:function(){var e=r.getElementsByTagName("tr")[0];e.style.backgroundColor="";for(var t=e.getElementsByTagName("td"),a=0;a<t.length;a++)t[a].style.backgroundColor="";WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(event)}}),e=r,t=document.getElementById("wptb-adaptive-table-checkbox"),e&&e.dataset.wptbAdaptiveTable&&"1"==e.dataset.wptbAdaptiveTable?t.checked=!0:t.checked=!1,a=r,n=document.getElementById("wptb-top-row-as-header"),a&&a.classList.contains("wptb-table-preview-head")?n.checked=!0:n.checked=!1,function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].style.borderColor;if(t){var a=document.getElementById("wptb-table-border-color");a&&(a.value=WPTB_Helper.rgbToHex(t))}var n=e[0].style.borderWidth;if(n){var l=document.getElementById("wptb-table-border-slider"),r=document.getElementById("wptb-table-border-number");l&&(l.value=parseInt(n)),r&&(r.value=parseInt(n))}var o=e[0].querySelector("td").style.borderWidth;if(o){var i=document.getElementById("wptb-inner-border-check"),s=document.getElementById("wptb-apply-inner-border");if(o&&0<parseInt(o)){if(i&&(i.checked=!0,s)){s.classList.add("visible");var d=document.getElementById("wptb-table-inner-border-slider"),c=document.getElementById("wptb-table-inner-border-number");d.value=parseInt(o),c.value=parseInt(o)}}else i.checked=!1}(n&&0<parseInt(n)||o&&0<parseInt(o))&&(document.getElementById("wptb-table-border-color-set-area").style.display="")}}(),jQuery("#wptb-table-border-color").wpColorPicker({change:function(e,t){var a=r.getElementsByTagName("td");r.style.border=document.querySelector("#wptb-table-border-number").value+"px solid "+t.color.toString();for(var n=0;n<a.length;n++){var l=document.querySelector("#wptb-table-inner-border-number").value;document.getElementById("wptb-inner-border-check").checked&&(a[n].style.border=(0!=l?l:1)+"px solid "+t.color.toString())}WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving(e)},clear:function(){var e=r.getElementsByTagName("td");r.style.borderColor="";for(var t=0;t<e.length;t++)e[t].style.borderColor="";(new WPTB_TableStateSaveManager).tableStateSet()}}),function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){var t=e[0].querySelector("td");if(t){var a=t.style.padding;if(a){var n=document.getElementById("wptb-table-cell-slider"),l=document.getElementById("wptb-table-cell-number");n&&(n.value=parseInt(a)),l&&(l.value=parseInt(a))}}}}(),c(document.getElementById("wptb-table-border-number"),1,50),c(document.getElementById("wptb-table-inner-border-number"),1,50),c(document.getElementById("wptb-table-cell-number"),1,50),c(document.getElementById("wptb-text-font-size-number"),1,50),c(document.getElementById("wptb-image-width-number"),2,100),c(document.getElementById("wptb-table-column-width-number"),2,500),c(document.getElementById("wptb-table-row-height-number"),2,200),document.getElementById("wptb-table-cell-slider").oninput=function(){document.getElementById("wptb-table-cell-number").value=this.value,s(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-cell-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-cell-number").onchange=function(){document.getElementById("wptb-table-cell-slider").value=this.value,s(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-slider").oninput=function(){document.getElementById("wptb-table-border-number").value=this.value,d(this.value),r.tdDefaultWidth();var e=document.getElementById("wptb-inner-border-check").checked,t=document.getElementById("wptb-table-border-color-set-area");0==this.value&&0==e?t.style.display="none":t.style.display=""},document.getElementById("wptb-table-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-border-number").onchange=function(){document.getElementById("wptb-table-border-slider").value=this.value,d(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-slider").oninput=function(){document.getElementById("wptb-table-inner-border-number").value=this.value,i(this.value),r.tdDefaultWidth()},document.getElementById("wptb-table-inner-border-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-inner-border-number").onchange=function(){document.getElementById("wptb-table-inner-border-slider").value=this.value,i(this.value),r.tdDefaultWidth(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-inner-border-check").onchange=function(){if(r){var e=this.checked?"checked":"unchecked";!function(e){var t=null!=document.querySelector("#wptb-table-border-color").value?document.querySelector("#wptb-table-border-color").value:"rgb(0,0,0)";0!=document.querySelector("#wptb-table-inner-border-slider").value&&0!=document.querySelector("#wptb-table-inner-border-number").value||(document.querySelector("#wptb-table-inner-border-slider").value=1,document.querySelector("#wptb-table-inner-border-number").value=1);var a=document.querySelector("#wptb-table-inner-border-slider").value+"px",n=document.getElementsByClassName("wptb-preview-table");if(0<n.length)if("checked"==e){document.getElementById("wptb-apply-inner-border").style.marginBottom="0px";for(var l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border=a+" solid "+t;document.getElementById("wptb-apply-inner-border").classList.add("visible")}else for(document.getElementById("wptb-apply-inner-border").classList.remove("visible"),l=n[0].getElementsByTagName("td"),r=0;r<l.length;r++)l[r].style.border="0px solid "+t,l[r].style.border=null}(e);var t=document.getElementById("wptb-table-border-slider").value,a=document.getElementById("wptb-table-border-color-set-area");a.style.display="unchecked"==e&&0==t?"none":"",(new WPTB_TableStateSaveManager).tableStateSet()}},document.getElementById("wptb-table-column-width-slider").oninput=function(){document.getElementById("wptb-table-column-width-number").value=this.value,r.addColumnWidth(this.value)},document.getElementById("wptb-table-column-width-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-number").onchange=function(){document.getElementById("wptb-table-column-width-slider").value=this.value,r.addColumnWidth(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-column-width-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getColumnWidth(r,e);r.addColumnWidth(t)}else{r.addColumnWidth(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getColumnWidth(r,a);document.getElementById("wptb-table-column-width-number").value=n,document.getElementById("wptb-table-column-width-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-slider").oninput=function(){document.getElementById("wptb-table-row-height-number").value=this.value,r.addRowHeight(this.value)},document.getElementById("wptb-table-row-height-slider").onchange=function(){(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-number").onchange=function(){document.getElementById("wptb-table-row-height-slider").value=this.value,r.addRowHeight(this.value),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-table-row-height-auto-fixed").onchange=function(){if(this.checked){var e=r.querySelector(".wptb-highlighted"),t=WPTB_Helper.getRowHeight(r,e);r.addRowHeight(t)}else{r.addRowHeight(!1,!0);var a=r.querySelector(".wptb-highlighted"),n=WPTB_Helper.getRowHeight(r,a);document.getElementById("wptb-table-row-height-number").value=n,document.getElementById("wptb-table-row-height-slider").value=n}(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-adaptive-table-checkbox").onchange=function(){this.checked?r.dataset.wptbAdaptiveTable=1:r.dataset.wptbAdaptiveTable=0,(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementById("wptb-top-row-as-header").onchange=function(){!function(e,t){if(t.checked)WPTB_Helper.dataTitleColumnSet(e),e.classList.add("wptb-table-preview-head"),e.rows[0].classList.add("wptb-table-head");else{var a=e.rows;e.classList.remove("wptb-table-preview-head"),a[0].classList.remove("wptb-table-head");for(var n=1;n<a.length;n++)for(var l=a[n].children,r=0;r<l.length;r++)l[r].removeAttribute("data-wptb-title-column"),l[r].removeAttribute("data-wptb-title-column-font-size"),l[r].removeAttribute("data-wptb-title-column-color"),l[r].removeAttribute("data-wptb-title-background-color"),l[r].removeAttribute("data-wptb-title-align")}}(r,this),(new WPTB_TableStateSaveManager).tableStateSet()};for(var p=0;p<l.length;p++)l[p].ondragstart=function(e){e.dataTransfer.setData("wptbElement",this.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+this.dataset.wptbElement,"wptbElIndic-"+this.dataset.wptbElement)};r&&(document.getElementById("wptb-activate-cell-management-mode").onclick=r.toggleTableEditMode,document.getElementById("wptb-table-edit-mode-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-left-scroll-panel-curtain-close").onclick=r.toggleTableEditMode,document.getElementById("wptb-add-end-row").onclick=r.addRowToTheEnd,document.getElementById("wptb-add-start-row").onclick=r.addRowToTheStart,document.getElementById("wptb-add-row-before").onclick=r.addRowBefore,document.getElementById("wptb-add-row-after").onclick=r.addRowAfter,document.getElementById("wptb-add-end-column").onclick=r.addColumnEnd,document.getElementById("wptb-add-start-column").onclick=r.addColumnStart,document.getElementById("wptb-add-column-before").onclick=r.addColumnBefore,document.getElementById("wptb-add-column-after").onclick=r.addColumnAfter,document.getElementById("wptb-delete-column").onclick=r.deleteColumn,document.getElementById("wptb-delete-row").onclick=r.deleteRow,document.getElementById("wptb-merge-cells").onclick=r.mergeCells,document.getElementById("wptb-split-cell").onclick=r.splitCell),document.querySelector(".wptb-left-panel-extend").onclick=function(){var e=document.querySelector(".wptb-container");e&&(e.classList.contains("collapsed")?e.classList.remove("collapsed"):e.classList.add("collapsed"))},document.getElementsByClassName("wptb-builder-panel")[0].onclick=function(e){e.target.classList.contains("wptb-ph-element")||WPTB_Helper.findAncestor(e.target,"wptb-ph-element")||e.target.classList.contains("wptb-fixed-toolbar")||WPTB_Helper.findAncestor(e.target,"wptb-fixed-toolbar")||u()};var m=document.getElementsByClassName("wptb-header");function u(){document.getElementsByClassName("wptb-elements-container")[0].style.display="table",document.getElementsByClassName("wptb-settings-section")[0].style.display="block",document.getElementById("element-options-group").style.display="none";var e=document.getElementById("wpcd_fixed_toolbar");e.hasAttribute("data-toolbar-active-id")&&document.getElementById(e.getAttribute("data-toolbar-active-id")).classList.remove("toolbar-active")}0<m.length&&(m=m[0]),m.onclick=function(){u()}},WPTB_List=function(e,t){var a,n=document.createElement("ul"),l=document.createElement("div"),r=void 0,o=!1;if(l.classList.add("wptb-list-item-container"),this.kind="list",""===e);else if(e){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(d=0;d<e.length;d++){var s=t.querySelector("li");a=new WPTB_ListItem(e[d],s,!0),n.appendChild(a.getDOMElement())}}else for(var d=0;d<3;d++)a=new WPTB_ListItem("<p>List Item "+(d+1)+"</p>"),n.appendChild(a.getDOMElement());return l.appendChild(n),this.getDOMElement=function(){return l},applyGenericItemSettings(this,r,o),WPTB_Helper.listItemsRecalculateIndex(n),this},WPTB_ListItem=function(e,t,a){var n=void 0;if(null==t||t&&a){null==e&&(e="New List Item");var l=document.createElement("li");if((o=document.createElement("div")).classList.add("wptb-list-item-content"),t){var r=t.getAttribute("style");r&&l.setAttribute("style",r)}l.appendChild(o),o.innerHTML=e,o.onkeyup=window.listItemKeyListener,n=!0}else{var o;(o=(l=t).getElementsByClassName("wptb-list-item-content")[0]).onkeyup=window.listItemKeyListener,n=!1}if(l.onmouseenter=function(e){var t=new WPTB_ActionsField;t.addActionField(2,l),t.setParameters(l),console.log(l)},l.onmouseleave=function(e){return(new WPTB_ActionsField).leaveFromField(e,l,2),!1},this.getDOMElement=function(){return l},n)return this},MultipleSelect=function(){var l=[],a=!1;return this.activateMultipleSelectMode=function(){l=[];for(var e=document.getElementsByClassName("wptb-preview-table")[0].getElementsByTagName("td"),t=0;t<e.length;t++)e[t].classList.remove("wptb-highlighted");a=!0},this.deactivateMultipleSelectMode=function(){a=!1},this.isActivated=function(){return a},this.pushSelectedCell=function(e){a&&(l.push(e),e.classList.add("wptb-highlighted"))},this.selectedCells=function(){return l},this.flushSelectedCells=function(){l=[]},this.getFirst=function(){for(var e,t=1e3,a=1e3,n=l.length-1;0<=n;n--)t>=l[n].dataset.xIndex&&a>=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.getLast=function(){for(var e,t=-1,a=-1,n=l.length-1;0<=n;n--)t<=l[n].dataset.xIndex&&a<=l[n].dataset.yIndex&&(e=l[n],t=l[n].dataset.xIndex,a=l[n].dataset.yIndex);return e},this.removeAllButFirst=function(){for(var e=this.getFirst(),t=1;t<l.length;t++)l[t].classList.add("wptb-fused-cell-"+e.dataset.xIndex+"-"+e.dataset.yIndex)},this};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Parser=function(e){var t=document.createElement("div");t.innerHTML=e;for(var a=t.children[0],n=[].concat(_toConsumableArray(a.querySelectorAll(".wptb-column-title-mobile-container"))),l=0;l<n.length;l++){n[l].parentNode.removeChild(n[l])}for(var r=a.querySelectorAll("td"),o=0;o<r.length;o++)r[o].classList.add("wptb-droppable"),r[o].classList.remove("wptb-column-title-mobile-not-elements");return a},WPTB_Parser2=function(e){if(Array.isArray(e)){var t=void 0;if(1==e.length)return t.appendChild(document.createTextNode(e[0]));if(0 in e){var a=e[0];if(t=document.createElement(a),1 in e&&Array.isArray(e[1]))for(var n=e[1],l=0;l<n.length;l++)Array.isArray(n[l])&&t.setAttribute(n[l][0],n[l][1]);if(2 in e)if(Array.isArray(e[2]))for(var r=0;r<e[2].length;r++)"string"!=typeof e[2][r]||"p"!=a.toLowerCase()?WPTB_Parser(e[2][r])&&t.appendChild(WPTB_Parser(e[2][r])):t.appendChild(document.createTextNode(e[2][r]));else"string"==typeof e[2]&&t.appendChild(document.createTextNode(e[2]))}return t}return!1},WPTB_Settings=function(){for(var e=document.getElementsByClassName("wptb-element"),t=0;t<e.length;t++)e[t].ondragstart=function(e){e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("wptbElement",e.target.dataset.wptbElement),e.dataTransfer.setData("wptbElIndic-"+e.target.dataset.wptbElement,"wptbElIndic-"+e.target.dataset.wptbElement)},e[t].ondragend=function(){var e=document.querySelector(".wptb-drop-handle"),t=document.querySelector(".wptb-drop-border-marker");(e||t)&&(e.style.display="none",t.style.display="none")};var a=new WPTB_TableStateSaveManager,n=document.getElementsByClassName("wptb-undo");0<n.length&&((n=n[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var l=document.getElementsByClassName("wptb-redo");0<l.length&&((l=l[0]).onclick=function(e){if(!this.classList.contains("wptb-undoredo-disabled")){a.tableStateGet(this.dataset.wptbUndoredo);var t=document.getElementsByClassName("wptb-undo-redo-container");0<t.length&&((t=t[0]).onmouseleave=function(e){e.target.onmouseleave="",WPTB_Table()})}});var r=document.getElementsByClassName("wptb-popup-window-modal")[0];document.getElementsByClassName("wptb-embed-btn")[0].onclick=function(){this.classList.contains("wptb-button-disable")||r.classList.add("wptb-popup-show")},window.onbeforeunload=function(e){return 0==document.getElementsByClassName("wptb-save-disabled").length||null},document.getElementsByClassName("wptb-popup-dark-area")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-popup-window-close-icon")[0].onclick=function(){r.classList.remove("wptb-popup-show")},document.getElementsByClassName("wptb-preview-btn")[0].onclick=function(e){this.classList.contains("wptb-button-disable")&&e.preventDefault()},document.getElementsByClassName("wptb-save-btn")[0].onclick=function(r){if((r.target.dataset.wptbTableStateNumberSave||0!=window.wptbTableStateNumberShow)&&window.wptbTableStateNumberShow!=r.target.dataset.wptbTableStateNumberSave){var e=document.querySelector(".wptb-edit-bar");if(e&&e.classList.contains("visible"))document.getElementsByClassName("wptb-preview-table")[0].toggleTableEditMode();var o=new XMLHttpRequest,t=(wptb_admin_object?wptb_admin_object.ajaxurl:ajaxurl)+"?action=save_table",i=document.getElementById("wptb-setup-name").value.trim(),s=void 0,a=document.getElementsByClassName("wptb-preview-table");if(a=0<a.length?(a=WPTB_Stringifier(a[0])).outerHTML:"",""===i||""===a){var n="";return""===i&&(n+="You must assign a name to the table before saving it.</br>"),""===a&&(n+="Table wasn't created"),(s=document.getElementById("wptb-messaging-area")).innerHTML='<div class="wptb-error wptb-message">Error: '+n+"</div>",s.classList.add("wptb-warning"),void setTimeout(function(){s.removeChild(s.firstChild)},4e3)}var l={title:i,content:a,security_code:wptb_admin_object.security_code};((rs=WPTB_Helper.detectMode())||(rs=document.wptbId))&&(l.id=rs),l=JSON.stringify(l),o.open("POST",t,!0),o.setRequestHeader("Content-type","application/json; charset=utf-8"),o.onreadystatechange=function(e){if(4==this.readyState&&200==this.status){var t=JSON.parse(o.responseText);if(s=document.getElementById("wptb-messaging-area"),"saved"==t[0]){document.wptbId=t[1],s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully saved.</div>',document.getElementsByClassName("wptb-embed-btn")[0].classList.remove("wptb-button-disable"),document.getElementById("wptb-embed-shortcode").value="[wptb id="+t[1]+"]";var a=document.getElementsByClassName("wptb-preview-btn");if(0<a.length){(a=a[0]).classList.remove("wptb-button-disable");var n=a.dataset.previewHref;n=n.replace("empty",t[1]),a.setAttribute("href",n)}}else if("edited"==t[0]){s.innerHTML='<div class="wptb-success wptb-message">Table "'+i+'" was successfully updated.</div>',r.target.dataset.wptbTableStateNumberSave=window.wptbTableStateNumberShow;var l=document.getElementsByClassName("wptb-save-btn");0<l.length&&(l=l[0]).classList.add("wptb-save-disabled")}else s.innerHTML='<div class="wptb-error wptb-message">Safety problems</div>';s.classList.add("wptb-success"),setTimeout(function(){s.removeChild(s.firstChild)},4e3)}},o.send(l)}}},WPTB_Space=function i(e){var t=void 0;if(e?t=e:(t=document.createElement("div")).classList.add("wptb-space-between"),t.ondragenter=function(){this.classList.add("visible")},t.ondragover=function(e){e.preventDefault()},t.ondragleave=function(){this.classList.remove("visible")},t.ondrop=function(e){e.stopPropagation();for(var t,a,n,l,r=e.target.nextSibling,o=e.target;!o.classList.contains("wptb-droppable");)o=o.parentNode;e.dataTransfer.getData("wptbElement")?(t=(l=e.dataTransfer.getData("wptbElement")).includes("list")?new WPTB_List:l.includes("image")?new WPTB_Image:l.includes("text")?new WPTB_Text:l.includes("button")?new WPTB_Button:void 0,this.classList.remove("visible"),null==r?(o.appendChild(t.getDOMElement()),o.appendChild(new i)):(o.insertBefore(t.getDOMElement(),r),o.insertBefore(new i,r))):(alert(e.dataTransfer.getData("node")),a=(t=document.getElementsByClassName(e.dataTransfer.getData("node"))[0]).nextSibling,n=t.parentNode,null!=a&&n.removeChild(a),null==r?(o.appendChild(t),o.appendChild(new i)):(o.insertBefore(t,r),o.insertBefore(new i,r))),this.classList.remove("visible")},!e)return t},WPTB_Stringifier=function(e){if(e){var t=e.cloneNode(!0);t.classList.add("wptb-table-preview-static-indic"),t.dataset.tableColumns=e.columns,t.style.width=null,t.style.minWidth=null,t.style.maxWidth=null;var a=t.getElementsByTagName("td");if(0<a.length)for(var n=0;n<a.length;n++){e.querySelector("wptb-table-preview-head")&&a[n].removeAttribute("data-x-index"),a[n].removeAttribute("data-y-index"),a[n].removeAttribute("draggable"),a[n].classList.remove("wptb-droppable");var l=a[n].getElementsByClassName("wptb-ph-element");if(0<l.length)for(var r=0;r<l.length;r++){var o=l[r].querySelectorAll(".mce-content-body");if(0<o.length)for(var i=0;i<o.length;i++)o[i].classList.remove("mce-content-body");var s=l[r].querySelectorAll("[data-mce-style]");if(0<s.length)for(var d=0;d<s.length;d++)s[d].removeAttribute("data-mce-style");var c=l[r].querySelectorAll("[contenteditable]");if(0<c.length)for(var p=0;p<c.length;p++)c[p].removeAttribute("contenteditable");var m=l[r].querySelectorAll("[spellcheck]");if(0<m.length)for(var u=0;u<m.length;u++)m[u].removeAttribute("spellcheck");var b=l[r].querySelectorAll("[id^=mce_]");if(0<b.length)for(var g=0;g<b.length;g++)b[g].removeAttribute("id");for(var w=l[r].querySelectorAll(".wptb-actions"),h=w.length;0<h&&w[0]&&w[0].parentNode;)w[0].parentNode.removeChild(w[0]),h--}if(a[n].hasAttribute("data-wptb-title-column")){var v=document.createElement("div"),y=document.createElement("div");v.classList.add("wptb-column-title-mobile-container"),y.classList.add("wptb-column-title-mobile"),y.dataset.wptbTitleColumn=a[n].dataset.wptbTitleColumn,y.setAttribute("style","font-size:"+a[n].dataset.wptbTitleColumnFontSize+"; \n color:"+a[n].dataset.wptbTitleColumnColor+"; background-color:"+a[n].dataset.wptbTitleBackgroundColor+"; text-align:"+a[n].dataset.wptbTitleAlign+";"),y.style.padding=a[n].style.padding,0==a[n].children.length&&a[n].classList.add("wptb-column-title-mobile-not-elements"),v.appendChild(y),a[n].insertBefore(v,a[n].firstChild)}}return t}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Stringifier2=function(e){1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(null==e)return"";if(null==e.tagName&&3==e.nodeType)return e.nodeValue;var t=[],a=void 0,n=!1,l=[].concat(_toConsumableArray(e.attributes)),r=[],o=[];if((e.parentNode.classList.contains("wptb-list-item-content")||e.parentNode.classList.contains("mce-content-body"))&&"p"==e.tagName.toLowerCase()?(a=e.childNodes,n=!0):a=0<e.children.length?e.children:e.childNodes,0<l.length)for(var i=0;i<l.length;i++)r[i]=[l[i].name,l[i].value];else r="";if(0<a.length)for(var s=0;s<a.length;s++){var d=WPTB_Stringifier(a[s]);Array.isArray(d)||n?o[s]=d:"string"==typeof d&&d&&(o=d)}else o="";return t.push(e.tagName.toLowerCase(),r,o),t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},array=[],WPTB_Table=function(e,t){var P,a,n,h,l=document.getElementsByClassName("wptb-settings-items"),f=document.getElementsByClassName("wptb-table-setup")[0],B=function(e){var t,a=this.rowSpan,n=this.colSpan,l=document.getElementsByClassName("wptb-no-cell-action"),r=document.getElementsByClassName("wptb-single-action"),o=document.getElementsByClassName("wptb-multiple-select-action"),i=document.getElementById("wptb-left-scroll-panel-cell-settings"),s=E(this),d=s[0],c=s[1];if(document.select.isActivated()){if(this.className.match(/wptb-highlighted/)){this.classList.remove("wptb-highlighted");for(var p=0;p<a;p++)for(var m=0;m<n;m++)array[d+p][c+m]=0}else{this.classList.add("wptb-highlighted");for(p=0;p<a;p++)for(m=0;m<n;m++)array[d+p][c+m]=1}if(0===(t=document.getElementsByClassName("wptb-highlighted").length)){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.add("visible"),l[p].removeAttribute("disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}else if(1===t){for(p=0;p<o.length;p++)o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled");for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.add("visible"),r[p].removeAttribute("disabled");var u=document.querySelector(".wptb-highlighted");if(u){var b=document.getElementById("wptb-table-column-width-slider"),g=document.getElementById("wptb-table-column-width-number"),w=document.getElementById("wptb-table-column-width-auto-fixed"),h=u.style.width;if(h)b.value=parseFloat(h,10),g.value=parseFloat(h,10),w.checked=!0;else if(u.dataset.wptbFixedWidth)b.value=u.dataset.wptbFixedWidth,g.value=u.dataset.wptbFixedWidth,w.checked=!0;else{var v=WPTB_Helper.getColumnWidth(P,u);b.value=v,g.value=v,w.checked=!1}var y=document.getElementById("wptb-table-row-height-slider"),f=document.getElementById("wptb-table-row-height-number"),B=document.getElementById("wptb-table-row-height-auto-fixed"),S=u.style.height;if(S)y.value=parseFloat(S,10),f.value=parseFloat(S,10),B.checked=!0;else if(u.dataset.wptbFixedHeight)y.value=u.dataset.wptbFixedHeight,f.value=u.dataset.wptbFixedHeight,B.checked=!0;else{var T=WPTB_Helper.getRowHeight(P,u);y.value=T,f.value=T,B.checked=!1}}i.classList.add("visible")}else{for(p=0;p<o.length;p++)P.isSquare(array)?(o[p].classList.add("visible"),o[p].removeAttribute("disabled")):(o[p].classList.remove("visible"),o[p].setAttribute("disabled","disabled"));for(p=0;p<l.length;p++)l[p].classList.remove("visible"),l[p].setAttribute("disabled","disabled");for(p=0;p<r.length;p++)r[p].classList.remove("visible"),r[p].setAttribute("disabled","disabled");i.classList.remove("visible")}}},S=function(e){for(var t=0;t<e.length;t++){for(var a=0;a<e[t].length;a++)" "+e[t][a];"\n"}P.isSquare(e)},T=function(){for(var e=document.getElementsByClassName("wptb-no-cell-action"),t=document.getElementsByClassName("wptb-single-action"),a=document.getElementsByClassName("wptb-multiple-select-action"),n=document.getElementById("wptb-left-scroll-panel-cell-settings"),l=P.getElementsByClassName("wptb-highlighted");l.length;)l[0].classList.remove("wptb-highlighted");n.classList.remove("visible");for(var r=0;r<array.length;r++)for(var o=0;o<array[r].length;o++)array[r][o]=0;for(r=0;r<a.length;r++)a[r].classList.remove("visible"),a[r].setAttribute("disabled","disabled");for(r=0;r<e.length;r++)e[r].classList.add("visible"),e[r].removeAttribute("disabled");for(r=0;r<t.length;r++)t[r].classList.remove("visible"),t[r].setAttribute("disabled","disabled")},E=function(e){for(var t=[],a=0;a<h;a++)t[a]=0;for(a=0;a<P.rows.length;a++)for(var n=P.rows[a].getElementsByTagName("td"),l=cellPointer=0;l<h;l+=stepsToMove)if(stepsToMove=1,t[l])t[l]--;else{var r=n[cellPointer++];if(r==e)return[a,l];if(1<r.rowSpan){for(var o=0;o<r.colSpan;o++)t[l+o]=r.rowSpan-1;stepsToMove=r.colSpan}else 1<r.colSpan&&(stepsToMove=r.colSpan)}};if(jQuery("#wptb-table-header-bg").val(""),jQuery("#wptb-even-row-bg").val(""),jQuery("#wptb-odd-row-bg").val(""),jQuery("#wptb-table-border-color").val(""),jQuery("#wptb-table-inner-border-number,#wptb-table-inner-border-slider").val("0"),jQuery("#wptb-table-border-number,#wptb-table-border-slider").val("0"),jQuery("#wptb-table-padding-number,#wptb-table-padding-slider").val("15"),e||t){for(var r=0;r<l.length;r++)"wptb-apply-inner-border"!==l[r].id&&l[r].classList.add("visible");(P=document.createElement("table")).classList.add("wptb-preview-table"),P.dataset.reconstraction=1,P.dataset.wptbAdaptiveTable=1;for(r=0;r<t;r++){(a=P.insertRow(-1)).classList.add("wptb-row");for(var g=0;g<e;g++)(n=new WPTB_Cell(B)).setCoords(r,g),a.appendChild(n.getDOMElement())}}else{var o=document.getElementsByClassName("wptb-preview-table");if(0<o.length){var i=(P=o[0]).getElementsByTagName("td");if(0<i.length)for(var s=0;s<i.length;s++)WPTB_Cell(B,i[s])}}P.toggleTableEditMode=function(){var e=document.getElementsByClassName("wptb-edit-bar"),t=document.getElementById("wptb-cell_mode_background"),a=document.getElementById("wptb-left-scroll-panel-curtain"),n=document.getElementById("wptb-left-scroll-panel-cell-settings"),l=document.getElementsByClassName("wptb-preview-table");if(0<l.length&&(l=l[0]),0<e.length)for(var r=0;r<e.length;r++)if(e[r].classList.contains("visible")){document.select.deactivateMultipleSelectMode(),e[r].classList.remove("visible"),t.classList.remove("visible"),a.classList.remove("visible"),n.classList.remove("visible"),l.parentNode.classList.remove("wptb-preview-table-manage-cells");var o=l.getElementsByTagName("td");if(0<o.length)for(var i=0;i<o.length;i++)o[i].classList.remove("wptb-highlighted")}else document.select.activateMultipleSelectMode(),e[r].classList.add("visible"),t.classList.add("visible"),a.classList.add("visible"),l.parentNode.classList.add("wptb-preview-table-manage-cells")},P.recalculateIndexes=function(e){for(var t=this.getElementsByTagName("tr"),a=void 0,n=0,l=0,r=[],o=document.getElementById("wptb-top-row-as-header"),i=0;i<t.length;i++){0==i?(null==e&&(t[i].style.backgroundColor=jQuery("#wptb-table-header-bg").val()),o.checked?null==e&&(this.classList.add("wptb-table-preview-head"),t[i].classList.add("wptb-table-head")):null==e&&(this.classList.remove("wptb-table-preview-head"),t[i].classList.remove("wptb-table-head"))):(i%2==0?null==e&&(t[i].style.backgroundColor=jQuery("#wptb-odd-row-bg").val()):null==e&&(t[i].style.backgroundColor=jQuery("#wptb-even-row-bg").val()),t[i].classList.remove("wptb-table-head")),r[i],a=t[i].getElementsByTagName("td"),null==r[i]&&(r[i]=[]);for(var s=0,d=0;d<a.length;d++){if(null!=r[i][d])for(var c=0;c<100;c++){if(null==r[i][s]){r[i][s]=a[d],a[d].dataset.xIndex=s;break}s++}else r[i][d]=a[d],a[d].dataset.xIndex=s;if(a[d].dataset.yIndex=i,1<a[d].colSpan)for(var p=1;p<a[d].colSpan;p++)s++,r[i][s]="tdDummy";if(1<a[d].rowSpan)for(var m=1;m<a[d].rowSpan;m++){null==r[i+m]&&(r[i+m]=[]);for(var u=0;u<a[d].colSpan;u++)r[i+m][s-a[d].colSpan+1+u]="tdDummy"}s++,0==i&&(l=s)}n<d&&(n=d)}this.columns=n,this.maxCols=l},P.addColumnWidth=function(m,u){var e=P.getElementsByClassName("wptb-highlighted");if(0<e.length){for(var t=0;t<e.length;t++){var a=e[t].dataset.xIndex;a&&function e(t,a){for(var n=P.rows,l=!1,r=[],o=0;o<n.length;o++)for(var i=n[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.xIndex==t){if(m)if(d.colSpan==a){d.style.width=m+"px",d.removeAttribute("data-wptb-fixed-width"),l=!0;var c=document.getElementById("wptb-table-column-width-auto-fixed");c.checked||(c.checked=!0)}else d.style.width=null,d.dataset.wptbFixedWidth=m,o!=n.length-1||l||e(t,a+1);else if(u)d.style.width=null,d.removeAttribute("data-wptb-fixed-width");else if(d.dataset.wptbFixedWidth)d.colSpan==a&&(d.style.width=d.dataset.wptbFixedWidth+"px",d.removeAttribute("data-wptb-fixed-width"));else if(d.style.width){for(var p=0;p<r.length;p++)r[p].style.width=d.style.width;r=[]}else r.push(d);break}}}(a,1)}P.tdDefaultWidth()}},P.tdDefaultWidth=function(){for(var e,t=P.rows,a=0,n=0,l=document.getElementsByClassName("wptb-table-setup")[0].offsetWidth,r=[],o=[],i=0,s=0,d="",c=0;c<t.length;c++)for(var p=t[c].children,m=0;m<p.length;m++){var u=p[m];if(r[parseInt(u.dataset.xIndex)]||o[parseInt(u.dataset.xIndex)])o[parseInt(u.dataset.xIndex)]?u.dataset.wptbFixedWidth||(u.dataset.wptbCssTdAutoWidth=!0):r[parseInt(u.dataset.xIndex)]&&u.removeAttribute("data-wptb-css-td-auto-width");else if(u.style.width?(r[parseInt(u.dataset.xIndex)]=parseFloat(u.style.width),u.removeAttribute("data-wptb-css-td-auto-width")):u.dataset.wptbFixedWidth||(o[parseInt(u.dataset.xIndex)]=100,u.dataset.wptbCssTdAutoWidth=!0),window.getComputedStyle(u,null)){var b=window.getComputedStyle(u,null),g=b.getPropertyValue("padding-left"),w=b.getPropertyValue("padding-right");i=parseFloat(g,10)+parseFloat(w,10);var h=b.getPropertyValue("border-left-width"),v=b.getPropertyValue("border-right-width");s=parseFloat(h,10)+parseFloat(v,10),r[parseInt(u.dataset.xIndex)]?(r[parseInt(u.dataset.xIndex)]+=i,r[parseInt(u.dataset.xIndex)]+=s):(o[parseInt(u.dataset.xIndex)]+=i,o[parseInt(u.dataset.xIndex)]+=s)}}for(var y=0;y<r.length;y++)r[y]&&(a+=r[y]);for(var f=0,B=0;B<o.length;B++)o[B]&&(n+=o[B],f++);var S=window.getComputedStyle(P,null),T=S.getPropertyValue("border-left-width"),E=S.getPropertyValue("border-right-width"),C=parseFloat(T,10)+parseFloat(E,10);e=a+n+C,P.dataset.wptbTableTdsSumMaxWidth=e,f?(P.dataset.wptbCellsWidthAutoCount=f,P.mergingСellsHorizontally?P.dataset.wptbFixedWidthSize=a-C:P.removeAttribute("data-wptb-fixed-width-size")):(P.removeAttribute("data-wptb-fixed-width-size"),P.removeAttribute("data-wptb-cells-width-auto-count"));var N=!1,x=void 0;e<l?f?(P.style.minWidth="100%",P.mergingСellsHorizontally?(x=(x=(l-a-C)/f)-i-s,N=!(P.style.width=null)):P.style.width="100%"):(P.style.width=null,P.style.minWidth=null,P.style.maxWidth=e+"px"):(P.style.maxWidth=null,P.style.minWidth=e+"px",x="100",N=!(P.style.width=null));var _=document.head;if(_){var I=_.querySelector('style[data-wptb-td-auto-width="true"]');I&&_.removeChild(I)}N&&((d=document.createElement("style")).setAttribute("data-wptb-td-auto-width",!0),d.innerHTML="[data-wptb-css-td-auto-width=true]{width:"+x+"px}",_&&_.appendChild(d))},P.addRowHeight=function(m,u){var e=P.getElementsByClassName("wptb-highlighted");if(0<e.length)for(var t=0;t<e.length;t++){var a=e[t].dataset.yIndex;a&&function e(t,a){for(var n=P.rows,l=!1,r=[],o=0;o<n.length;o++)for(var i=n[o].children,s=0;s<i.length;s++){var d=i[s];if(d.dataset.yIndex==t)if(m){if(d.rowSpan==a){d.style.height=m+"px",d.removeAttribute("data-wptb-fixed-heidht"),l=!0;var c=document.getElementById("wptb-table-row-height-auto-fixed");c.checked||(c.checked=!0);continue}d.style.height=null,d.dataset.wptbFixedHeight=m,s!=i.length-1||l||e(t,a+1)}else if(u)d.style.height=null,d.removeAttribute("data-wptb-fixed-heidht");else if(d.dataset.wptbFixedHeight)(d.rowSpan=a)&&(d.style.height=d.dataset.wptbFixedHeight+"px",d.removeAttribute("data-wptb-fixed-width"));else if(d.style.height){for(var p=0;p<r.length;p++)r[p].style.height=d.style.height;r=[]}else r.push(d)}}(a,1)}},P.reconstraction=function(){var e=P.getElementsByTagName("td"),t=document.getElementsByClassName("wptb-adaptive-table-chose-block");0<t.length&&(t=t[0]),P.mergingСellsHorizontally=!1,P.mergingCellsVertically=!1,P.dataset.reconstraction=1,t.style.display="block";for(var a=0,n=0;n<e.length&&(1<e[n].colSpan&&(P.dataset.reconstraction=0,t.style.display="none",P.mergingСellsHorizontally=!0,a++),1<e[n].rowSpan&&(P.dataset.reconstraction=0,t.style.display="none",P.mergingCellsVertically=!0,a++),2!=a);n++);},P.addColumnEnd=function(){var e=void 0,t=document.getElementsByClassName("wptb-preview-table"),a=void 0,n=void 0;0<t.length&&(a=t[0].querySelector("td")),a&&(n=a.getAttribute("style"));for(var l=0;l<P.rows.length;l++)e=new WPTB_Cell(B),n&&(e.getDOMElement().setAttribute("style",n),e.getDOMElement().style.width=null),P.rows[l].appendChild(e.getDOMElement()),array[l].push(0);h++,P.recalculateIndexes(),P.tdDefaultWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addColumnStart=function(){var e=void 0,t=void 0,a=document.getElementsByClassName("wptb-preview-table"),n=void 0,l=void 0;0<a.length&&(n=a[0].querySelector("td")),n&&(l=n.getAttribute("style"));for(var r=0;r<P.rows.length;r++)e=new WPTB_Cell(B),l&&(e.getDOMElement().setAttribute("style",l),e.getDOMElement().style.width=null),(t=P.rows[r].getElementsByTagName("td")[0])?P.rows[r].insertBefore(e.getDOMElement(),t):P.rows[r].appendChild(e.getDOMElement()),array[r].push(0);h++,P.recalculateIndexes(),P.tdDefaultWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addColumnAfter=function(e){var t=P.rows,a=void 0,n=void 0,l=document.querySelector(".wptb-highlighted"),r=l.getAttribute("style"),o=null!=e&&"number"==typeof e?e:E(l)[1];if(h-o-l.colSpan+1==1)P.addColumnEnd();else{for(var i=!1,s=void 0,d=void 0,c=void 0,p=[],m=void 0,u=0;u<h;u++)p.push(0);for(u=0;u<t.length;u++){a=0,n=t[u].getElementsByTagName("td"),i=!1;for(var b=0;b<h;b+=s){if(s=1,i){d=new WPTB_Cell(B),r&&(d.getDOMElement().setAttribute("style",r),d.getDOMElement().style.width=null),m&&t[u].contains(m)?(c=m.nextSibling)?t[u].insertBefore(d.getDOMElement(),c):t[u].appendChild(d.getDOMElement()):t[u].insertBefore(d.getDOMElement(),n[0]);break}if(0<p[b])o==b&&(i=!0);else if(1<(m=n[a++]).rowSpan){s=m.colSpan;for(var g=0;g<m.colSpan;g++)p[b+g]=m.rowSpan,b+g==o&&(i=!0)}else if(1<m.colSpan){s=m.colSpan;for(g=0;g<m.colSpan;g++)b+g==o&&(i=!0)}else b==o&&(i=!0)}for(var w=0;w<h;w++)0<p[w]&&p[w]--}for(u=0;u<array.length;u++)array[u].push(0);h++,S(array),P.recalculateIndexes(),P.addColumnWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()}},P.addColumnBefore=function(){var e=document.querySelector(".wptb-highlighted"),t=E(e)[1];0===t?P.addColumnStart():P.addColumnAfter(t-1)},P.addRowToTheEnd=function(){var e,t=P.insertRow(-1),a=void 0,n=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<n.length&&(l=n[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<h;o++)a=new WPTB_Cell(B),r&&a.getDOMElement().setAttribute("style",r),t.appendChild(a.getDOMElement());e=Array.from(array[0]),array.push(e),S(array),P.recalculateIndexes(),P.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addRowToTheStart=function(){var e,t=P.insertRow(0),a=void 0,n=document.getElementsByClassName("wptb-preview-table"),l=void 0,r=void 0;t.classList.add("wptb-row"),0<n.length&&(l=n[0].querySelector("td")),l&&(r=l.getAttribute("style"));for(var o=0;o<h;o++)a=new WPTB_Cell(B),r&&a.getDOMElement().setAttribute("style",r),t.appendChild(a.getDOMElement());e=Array.from(array[0]),array.push(e),S(array),P.recalculateIndexes(),P.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.addRowBefore=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=E(e)[0],n=void 0,l=a-1;0<=l;l--){var r=P.rows[l].children,o=r.length;if(0<o)for(var i=0;i<o;i++)if(1==r[i].rowSpan){a=l,n=!0;break}if(n)break}0===a?P.addRowToTheStart():P.addRowAfter(a,t)},P.addRowAfter=function(e,t){var a,n=void 0;if(null!=e&&"number"==typeof e||null!=t)n=e;else{var l=document.querySelector(".wptb-highlighted");t=l.getAttribute("style"),n=(e=E(l)[0])+l.rowSpan-1}var r=0;if(n<P.rows.length-1){for(var o=0;o<=n;o++){var i=P.rows[o].children,s=i.length;if(0<s)for(var d=0;d<s;d++){n<i[d].rowSpan-1+o&&i[d].rowSpan++}}var c=P.rows[n+1].children,p=c.length;if(0<p)for(var m=0;m<p;m++)r+=c[m].colSpan}else r=array[0].length;var u=P.insertRow(n+1);for(u.classList.add("wptb-row"),g=0;g<r;g++){var b=new WPTB_Cell(B);b.getDOMElement().setAttribute("style",t),b.getDOMElement().style.width=null,b.getDOMElement().style.height=null,u.appendChild(b.getDOMElement())}a=Array.from(array[0]),array.push(a),S(array),P.recalculateIndexes(),P.addColumnWidth(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.isSquare=function(e){for(var t,a,n=-1,l=-1,r=-1,o=-1,i=0,s=0;s<e.length;s++)for(var d=0;d<e[s].length;d++)1==e[s][d]&&((d<l||-1==l)&&(l=d),(s<n||-1==n)&&(n=s));for(s=e.length-1;-1<s;s--)for(d=e[s].length-1;-1<d;d--)1==e[s][d]&&(o<d&&(o=d),r<s&&(r=s));for(s=n;s<r;s++)for(d=l;d<o;d++)if(0==e[s][d]||null==e[s][d])return!1;for(s=0;s<e.length;s++)for(d=0;d<e[s].length;d++)1==e[s][d]&&i++;return(t=r-n+1)*(a=o-l+1)===i&&[t,a]},P.mergeCells=function(){for(var e=P.isSquare(array),t=e[0],a=e[1],n=document.querySelector(".wptb-highlighted"),l=[].slice.call(document.getElementsByClassName("wptb-highlighted"),1),r=[],o=0;o<l.length;o++){var i=l[o].getElementsByClassName("wptb-ph-element");if(0<i.length)for(var s=i.length,d=0;d<s;d++)r.push(i[d]);l[o].parentNode.removeChild(l[o])}if(0<r.length)for(var c=0;c<r.length;c++)n.appendChild(r[c]);n.colSpan=a,n.rowSpan=t,P.recalculateIndexes(),P.reconstraction();var p=n.style.width,m=n.dataset.wptbFixedWidth;p?P.addColumnWidth(parseFloat(p,10)):m?P.addColumnWidth():P.addColumnWidth(!1,!0);var u=n.style.height,b=n.dataset.wptbFixedHeight;u?P.addRowHeight(parseFloat(u,10)):b?P.addRowHeight():P.addRowHeight(!1,!0),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.splitCell=function(){var e=document.getElementsByClassName("wptb-highlighted")[0],t=e.rowSpan,a=e.colSpan,n=e.getAttribute("style"),l=E(e)[0],r=P.rows[l],o=e.dataset.xIndex;e.rowSpan=1;for(var i=e.colSpan=1;i<a;i++){var s=new WPTB_Cell(B);s.getDOMElement().setAttribute("style",n),s.getDOMElement().classList.add("wptb-highlighted"),e.nextSibling?r.insertBefore(s.getDOMElement(),e.nextSibling):r.appendChild(s.getDOMElement())}if(1<t)for(var d=1;d<t;d++){var c=void 0,p=P.rows[l+d],m=p.children,u=m.length;if(0<u)for(var b=0;b<u;b++)if(Number(m[b].dataset.xIndex)>Number(o)){c=m[b];break}for(var g=0;g<a;g++){var w=new WPTB_Cell(B);w.getDOMElement().setAttribute("style",n),null!=c?p.insertBefore(w.getDOMElement(),c):p.appendChild(w.getDOMElement())}}P.recalculateIndexes(),P.reconstraction(),P.addColumnWidth(),P.addRowHeight(),WPTB_Helper.dataTitleColumnSet(P),T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.findRowspannedCells=function(e){var t,a=[];if(actualPoints=function(e){for(var t=P.rows[e].getElementsByTagName("td"),a=0,n=0;n<t.length;n++)a+=t[n].colSpan;return a}(e),actualPoints===h)return[];t=h-actualPoints;for(var n=e-1;0<=n&&t;n--){var l=P.rows[n].getElementsByTagName("td");for(n=0;n<l.length;n++)1<l[n].rowSpan&&(a.push(l[n]),t-=l[n].colSpan)}return a},P.addLackingCells=function(){for(var e=[],t=0;t<P.rows.length;t++)e.push(0);for(t=0;t<P.rows.length;t++)for(var a=P.rows[t].getElementsByTagName("td"),n=0;n<a.length;n++)if(1<a[n].rowSpan)for(var l=1;l<a[n].rowSpan;l++)e[t+l]++;for(t=0;t<P.rows.length;t++){a=P.rows[t].getElementsByTagName("td");var r=0;for(n=0;n<a.length;n++)r+=a[n].colSpan;r+=e[t],difference=h-r;for(n=0;n<difference;n++){var o=new WPTB_Cell(B);P.rows[t].appendChild(o.getDOMElement())}}},P.deleteRow=function(){var e=document.querySelector(".wptb-highlighted"),t=e.getAttribute("style"),a=e.rowSpan,n=E(e)[0],l=void 0;null==a&&(a=1);for(var r=0;r<a;r++){var o=P.rows[n].children,i=P.rows[n+1],s=void 0,d=void 0,c=[];if(null!=i){d=(s=i.children).length;for(var p=0;p<o.length;p++)if(1<o[p].rowSpan){var m=new WPTB_Cell(B);m.getDOMElement().setAttribute("style",t),m.getDOMElement().colSpan=o[p].colSpan,m.getDOMElement().rowSpan=o[p].rowSpan-1;for(var u=void 0,b=0;b<d;b++)if(Number(s[b].dataset.xIndex)>Number(o[p].dataset.xIndex)){u=s[b];break}u?c.push([m,u]):c.push([m])}if(0<c.length)for(var g=0;g<c.length;g++)null!=c[g][1]?i.insertBefore(c[g][0].getDOMElement(),c[g][1]):i.appendChild(c[g][0].getDOMElement())}var w=P.rows;if(0<w.length)for(var h=0;h<n;h++){var v=w[h].children;if(0<v.length)for(var y=0;y<v.length;y++)v[y].rowSpan-1>=n-h&&v[y].rowSpan--}l=Array.from(array[0]),array.pop(l),S(array),P.getElementsByTagName("tbody")[0].removeChild(P.rows[n]),0==P.rows.length&&(P.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),P.recalculateIndexes(),WPTB_Helper.dataTitleColumnSet(P)}T(),(new WPTB_TableStateSaveManager).tableStateSet()},P.deleteColumn=function(){for(var e=document.querySelector(".wptb-highlighted"),t=e.dataset.xIndex,a=e.colSpan,n=0;n<a;n++){for(var l=0;l<P.rows.length;l++){var r=P.rows[l].children,o=r.length;if(0<o)for(var i=o-1;0<=i;i--){if(Number(r[i].dataset.xIndex)==Number(t)){1<r[i].colSpan?r[i].colSpan--:P.rows[l].removeChild(r[i]);break}if(Number(r[i].dataset.xIndex)<Number(t)&&Number(r[i].dataset.xIndex)+Number(r[i].colSpan-1)>=t){1<r[i].colSpan&&r[i].colSpan--;break}}}for(var s=0;s<P.rows.length;s++)null!=array[s]&&array[s].pop();h--,0==P.querySelectorAll("td").length&&(P.toggleTableEditMode(),f.innerHTML="",WPTB_Helper.settingsPanelClear(),document.getElementsByClassName("wptb-table-generator")[0].style.display="table"),P.recalculateIndexes(),P.tdDefaultWidth(),WPTB_Helper.dataTitleColumnSet(P)}T(),(new WPTB_TableStateSaveManager).tableStateSet()},document.getElementsByClassName("wptb-table-generator")[0].style.display="none",array=function(){for(var e=[],t=[],a=0;a<P.rows.length;a++){for(var n=P.rows[a].getElementsByTagName("td"),l=0,r=0;r<n.length;r++)l+=n[r].colSpan;e.push(l)}h=Math.max.apply(null,e);var o=P.rows.length;for(a=0;a<o;a++)for(t[a]=[],r=0;r<h;r++)t[a].push(0);return S(t),t}(),T(),S(array),f.appendChild(P),P.recalculateIndexes(!0),P.reconstraction(),P.tdDefaultWidth(),f.onresize=function(){P.tdDefaultWidth()},WPTB_LeftPanel()},WPTB_TableStateSaveManager=function(){this.tableStateSet=function(){var e=document.getElementsByClassName("wptb-preview-table");if(0<e.length){e=e[0],window.wptbTableStateSaving||(window.wptbTableStateSaving=[]),window.wptbTableStateSaving.length>window.wptbTableStateNumberShow+1&&(window.wptbTableStateSaving=window.wptbTableStateSaving.slice(0,window.wptbTableStateNumberShow+1));for(var t=e.cloneNode(!0),a=t.getElementsByClassName("wptb-highlighted"),n=0;n<a.length;n++)a[n].classList.remove("wptb-highlighted");for(var l=t.getElementsByClassName("wptb-directlyhovered"),r=0;r<l.length;r++)l[r].classList.remove("wptb-directlyhovered");var o="",i=document.head;if(i){var s=i.querySelector('style[data-wptb-td-auto-width="true"]');s&&(o=s.innerHTML)}var d=t.querySelectorAll(".mce-content-body");if(0<d.length)for(var c=0;c<d.length;c++)d[c].classList.remove("mce-content-body");var p=t.querySelectorAll("[data-mce-style]");if(0<p.length)for(var m=0;m<p.length;m++)p[m].removeAttribute("data-mce-style");var u=t.querySelectorAll("[id^=mce_]");if(0<u.length)for(var b=0;b<u.length;b++)u[b].removeAttribute("id");if(window.wptbTableStateSaving.push([t,o]),window.wptbTableStateNumberShow=window.wptbTableStateSaving.length-1,1<window.wptbTableStateSaving.length){var g=document.getElementsByClassName("wptb-undo");0<g.length&&(g=g[0]).classList.remove("wptb-undoredo-disabled")}var w=document.getElementsByClassName("wptb-redo");0<w.length&&(w=w[0]).classList.add("wptb-undoredo-disabled");var h=document.getElementsByClassName("wptb-save-btn");0<h.length&&(!(h=h[0]).dataset.wptbTableStateNumberSave&&0==window.wptbTableStateNumberShow||window.wptbTableStateNumberShow==h.dataset.wptbTableStateNumberSave?h.classList.add("wptb-save-disabled"):h.classList.remove("wptb-save-disabled"))}},this.tableStateGet=function(e){if(e&&window.wptbTableStateSaving&&1<window.wptbTableStateSaving.length){if("undo"==e){if(!(0<window.wptbTableStateNumberShow))return!1;window.wptbTableStateNumberShow--}else if("redo"==e){if(!(window.wptbTableStateNumberShow<window.wptbTableStateSaving.length-1))return!1;window.wptbTableStateNumberShow++}var t=document.getElementsByClassName("wptb-undo");0<t.length&&(t=t[0]),0==window.wptbTableStateNumberShow?t&&t.classList.add("wptb-undoredo-disabled"):0<window.wptbTableStateNumberShow&&t&&t.classList.remove("wptb-undoredo-disabled");var a=document.getElementsByClassName("wptb-redo");0<a.length&&(a=a[0]),window.wptbTableStateNumberShow==window.wptbTableStateSaving.length-1?a&&a.classList.add("wptb-undoredo-disabled"):window.wptbTableStateNumberShow<window.wptbTableStateSaving.length-1&&a&&a.classList.remove("wptb-undoredo-disabled");var n=document.getElementsByClassName("wptb-save-btn");0<n.length&&(!(n=n[0]).dataset.wptbTableStateNumberSave&&0==window.wptbTableStateNumberShow||window.wptbTableStateNumberShow==n.dataset.wptbTableStateNumberSave?n.classList.add("wptb-save-disabled"):n.classList.remove("wptb-save-disabled"));var l=document.getElementsByClassName("wptb-table-setup");if(0<l.length){if((l=l[0]).innerHTML="",l.appendChild(window.wptbTableStateSaving[window.wptbTableStateNumberShow][0]),window.wptbTableStateSaving[window.wptbTableStateNumberShow][1]){var r=document.createElement("style");r.setAttribute("data-wptb-td-auto-width",!0),r.innerHTML=window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];var o=document.head;if(o){var i=o.querySelector('style[data-wptb-td-auto-width="true"]');i&&o.removeChild(i),o.appendChild(r)}}WPTB_Helper.settingsPanelClear(),WPTB_Helper.elementOptionsPanelClear(),WPTB_LeftPanel();var s=document.getElementById("wptb-left-scroll-panel-cell-settings");s&&s.classList.remove("visible")}}}};function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}var WPTB_Text=function(e,t){var a=document.createElement("div"),n=document.createElement("div"),l=document.createElement("p"),r=void 0,o=!1;if(a.classList.add("wptb-text-container"),l.innerHTML=null!=e?e:"Text",n.appendChild(l),a.appendChild(n),t){var i=t.className.match(/wptb-element-((.+-)\d+)/i);i&&Array.isArray(i)&&(r=i[1],o=!0);for(var s=[].concat(_toConsumableArray(t.attributes)),d=0;d<s.length;d++)a.setAttribute(s[d].name,s[d].value)}return this.kind="text",this.getDOMElement=function(){return a},applyGenericItemSettings(this,r,o),this},WPTB_innerElementSet=function p(t){t.ondragenter=function(e){-1==e.dataTransfer.types.indexOf("wptbelement")&&-1==e.dataTransfer.types.indexOf("wptb-moving-mode")||(WPTB_DropHandle(this,e),t.classList.add("wptb-ondragenter"))},t.ondragover=function(e){e.preventDefault(),WPTB_DropHandle(this,e)},t.ondragleave=function(){},t.ondrop=function(e){this.classList.remove("wptb-ondragenter");var t=void 0,a=void 0;if(e.preventDefault(),e.stopPropagation(),e.dataTransfer.getData("wptbElement")||e.dataTransfer.getData("node")){var n,l=void 0,r=void 0;if(0<document.getElementsByClassName("wptb-drop-handle").length&&(l=document.getElementsByClassName("wptb-drop-handle")[0]),0<document.getElementsByClassName("wptb-drop-border-marker").length&&(r=document.getElementsByClassName("wptb-drop-border-marker")[0]),t=e.dataTransfer.getData("wptbElement")?(t="list"==(n=e.dataTransfer.getData("wptbElement"))?new WPTB_List:"image"==n?new WPTB_Image:"text"==n?new WPTB_Text:"button"==n?new WPTB_Button:void 0).getDOMElement():(a=e.dataTransfer.getData("node"),document.getElementsByClassName(a)[0]),"block"==l.style.display){var o=void 0;if("Drop Here"==l.dataset.text)(o=l.getDOMParentElement()).appendChild(t);else{var i=l.getDOMParentElement();if(o=i.parentNode,"Above Element"==l.dataset.text)o.insertBefore(t,i);else if("Below Element"==l.dataset.text){var s=i.nextSibling;o.insertBefore(t,s)}}var d=o.parentNode;if(d.classList.contains("wptb-table-head")){var c=WPTB_Helper.findAncestor(d,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(c)}if(l.style.display="none",r.style.display="none",p(t),!t.classList.contains("wptb-image-container")||t.classList.contains("wptb-moving-mode"))t.classList.remove("wptb-moving-mode"),(new WPTB_TableStateSaveManager).tableStateSet();return!0}}},t.onmouseover=function(e){t.classList.remove("wptb-ondragenter")}},applyGenericItemSettings=function(r,e){var t,o,a=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=r.getDOMElement();if(null==e||1==a){t=document.counter.nextIndex(r.kind);for(var n=document.getElementsByClassName("wptb-ph-element"),l=[],s=0;s<n.length;s++){var d=new RegExp("wptb-element-"+r.kind+"-(\\d+)","i"),c=n[s].className.match(d);c&&l.push(c[1])}if(0<l.length)t=Math.max.apply(Math,l)+1;else t=1}else e&&!a&&(t=e.split("-")[1]);i.onmouseenter=function(e){if(!e.target.classList.contains("wptb-moving-mode")){var t=new WPTB_ActionsField;if(t.addActionField(1,i),t.setParameters(i),i.classList.remove("wptb-ondragenter"),"button"===r.kind){var a=i.querySelector("a"),n=a.querySelector("div");a.onclick=function(e){e.preventDefault()},WPTB_Helper.buttonsTinyMceInit(n)}else if("text"===r.kind)tinyMCE.init({target:i.childNodes[0],inline:!0,plugins:"link, paste",dialog_type:"modal",theme:"modern",menubar:!1,fixed_toolbar_container:"#wpcd_fixed_toolbar",paste_as_text:!0,toolbar:"bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify",setup:function(e){e.on("change",function(e){var t=WPTB_Helper.findAncestor(i,"wptb-row");if(t.classList.contains("wptb-table-head")){var a=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(a)}}),e.on("keydown",function(e){var t=new WPTB_ActionsField;t.addActionField(1,i),t.setParameters(i)}),e.on("keyup",function(e){var t=new WPTB_ActionsField;t.addActionField(1,i),t.setParameters(i),e.target.onblur=function(){(new WPTB_TableStateSaveManager).tableStateSet()}})},init_instance_callback:function(e){(window.currentEditor=e).on("focus",function(e){var t=document.getElementsByClassName("wptb-builder-panel")[0].offsetWidth;window.currentEditor&&55<=document.getElementById("wptb_builder").scrollTop&&"none"!=window.currentEditor.bodyElement.style.display?(document.getElementById("wpcd_fixed_toolbar").style.position="fixed",document.getElementById("wpcd_fixed_toolbar").style.right=t/2-document.getElementById("wpcd_fixed_toolbar").offsetWidth/2+"px",document.getElementById("wpcd_fixed_toolbar").style.top="100px"):(document.getElementById("wpcd_fixed_toolbar").style.position="static",delete document.getElementById("wpcd_fixed_toolbar").style.right,delete document.getElementById("wpcd_fixed_toolbar").style.top)})}});else{o=i.getElementsByClassName("wptb-list-item-content");for(var l=0;l<o.length;l++)WPTB_Helper.listItemsTinyMceInit(o[l])}}},i.onmouseleave=function(e){var t=new WPTB_ActionsField;t.wptbActions&&"1"!=t.wptbActions.type||t.leaveFromField(e,i,1)};var p=document.getElementsByClassName("wptb-actions");if(0<p.length&&(p=p[0]),"text"==r.kind){new MutationObserver(function(e){var t=WPTB_Helper.findAncestor(i,"wptb-row");if(t.classList.contains("wptb-table-head")){var a=WPTB_Helper.findAncestor(t,"wptb-preview-table");WPTB_Helper.dataTitleColumnSet(a)}}).observe(r.getDOMElement(),{attributes:!0,attributeFilter:["style"]})}var m=i.className.match(/wptb-element-(.+)-(\d+)/i);m&&i.classList.remove(m[0]),i.classList.contains("wptb-ph-element")||i.classList.add("wptb-ph-element"),i.classList.contains("wptb-element-"+r.kind+"-"+t)||i.classList.add("wptb-element-"+r.kind+"-"+t),new WPTB_ElementOptions(r,t,e),document.counter.increment(r.kind)};
|
inc/admin/js/core/WPTB_ElementOptions.js
CHANGED
@@ -109,72 +109,70 @@ var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {
|
|
109 |
} else if ( element.kind == 'image' ) {
|
110 |
let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );
|
111 |
if ( affectedEl.length > 0 ) {
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
if ( selectOption[i].value == imgAlign ) {
|
124 |
-
selectOption[i].selected = true;
|
125 |
}
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
let elementsA = wptbImageWrapper.getElementsByTagName( 'a' );
|
130 |
-
if ( elementsA.length > 0 ) {
|
131 |
-
let a = elementsA[0];
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
}
|
|
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
if ( imageLinkHref ) {
|
142 |
-
inputImageLink.value = imageLinkHref;
|
143 |
-
}
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
150 |
|
151 |
-
|
|
|
|
|
|
|
|
|
152 |
|
153 |
-
|
154 |
-
imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );
|
155 |
|
156 |
-
|
157 |
-
|
158 |
-
}
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
let imageWidthInputRange = prop.querySelector( 'input[type="range"][data-type="image-size"]' ),
|
164 |
-
imageWidthInputNumber = prop.querySelector( 'input[type="number"][data-type="image-size"]' );
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
|
|
169 |
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
let imgAlternativeText = img[0].getAttribute('alt'),
|
174 |
-
imageAlternativeTextInput = prop.querySelector( 'input[type="text"][data-type="alternative-text"]' );
|
175 |
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
}
|
180 |
}
|
@@ -461,7 +459,13 @@ var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {
|
|
461 |
this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;
|
462 |
break;
|
463 |
case 'image-alignment':
|
464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
break;
|
466 |
case 'font-size':
|
467 |
affectedEl.style.fontSize = val + 'px';
|
109 |
} else if ( element.kind == 'image' ) {
|
110 |
let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );
|
111 |
if ( affectedEl.length > 0 ) {
|
112 |
+
let elementsA = affectedEl[0].getElementsByTagName( 'a' );
|
113 |
+
if ( elementsA.length > 0 ) {
|
114 |
+
let a = elementsA[0];
|
115 |
+
|
116 |
+
if ( a ) {
|
117 |
+
// set select according to the alignment of the image
|
118 |
+
let imgAlign;
|
119 |
+
if( a.style.float == 'none' ) {
|
120 |
+
imgAlign = 'center';
|
121 |
+
} else {
|
122 |
+
imgAlign = a.style.float;
|
|
|
|
|
123 |
}
|
124 |
+
let imageAlignmentSelect = prop.querySelector( 'select[data-type="image-alignment"]' ),
|
125 |
+
selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );
|
|
|
|
|
|
|
|
|
126 |
|
127 |
+
for ( let i = 0; i < selectOption.length; i++ ) {
|
128 |
+
if ( selectOption[i].value == imgAlign ) {
|
129 |
+
selectOption[i].selected = true;
|
130 |
}
|
131 |
+
}
|
132 |
|
133 |
+
a.onclick = function( e ) {
|
134 |
+
e.preventDefault();
|
135 |
+
}
|
|
|
|
|
|
|
136 |
|
137 |
+
// set text link for input field of setting panel
|
138 |
+
let imageLinkHref = a.getAttribute( 'href' ),
|
139 |
+
inputImageLink = prop.querySelector( 'input[data-type="image-link"]' );
|
140 |
+
if ( imageLinkHref ) {
|
141 |
+
inputImageLink.value = imageLinkHref;
|
142 |
+
}
|
143 |
|
144 |
+
// set checkbox for target of link
|
145 |
+
let imageLinkTarget = a.getAttribute( 'target' ),
|
146 |
+
imageLinkTargetInput = prop.querySelector( 'input[data-type="image-link-target"]' ),
|
147 |
+
imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),
|
148 |
+
imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];
|
149 |
|
150 |
+
imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];
|
|
|
151 |
|
152 |
+
imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );
|
153 |
+
imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );
|
|
|
154 |
|
155 |
+
if ( imageLinkTarget && imageLinkTarget == '_blank' ) {
|
156 |
+
imageLinkTargetInput.checked = true;
|
157 |
+
}
|
|
|
|
|
158 |
|
159 |
+
// set value for input fields of image size
|
160 |
+
let imgWidth = a.style.width;
|
161 |
+
if ( imgWidth ) {
|
162 |
+
let imageWidthInputRange = prop.querySelector( 'input[type="range"][data-type="image-size"]' ),
|
163 |
+
imageWidthInputNumber = prop.querySelector( 'input[type="number"][data-type="image-size"]' );
|
164 |
|
165 |
+
imageWidthInputRange.value = parseInt( imgWidth );
|
166 |
+
imageWidthInputNumber.value = parseInt( imgWidth );
|
167 |
+
}
|
|
|
|
|
168 |
|
169 |
+
let img = a.getElementsByTagName( 'img' );
|
170 |
+
if ( img.length > 0 ) {
|
171 |
+
// set value for input field of alternative text image
|
172 |
+
let imgAlternativeText = img[0].getAttribute('alt'),
|
173 |
+
imageAlternativeTextInput = prop.querySelector( 'input[type="text"][data-type="alternative-text"]' );
|
174 |
+
|
175 |
+
imageAlternativeTextInput.value = imgAlternativeText;
|
176 |
}
|
177 |
}
|
178 |
}
|
459 |
this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;
|
460 |
break;
|
461 |
case 'image-alignment':
|
462 |
+
let wptbImageFloatValue = '';
|
463 |
+
if( this.value == 'center' ) {
|
464 |
+
wptbImageFloatValue = 'none';
|
465 |
+
} else {
|
466 |
+
wptbImageFloatValue = this.value;
|
467 |
+
}
|
468 |
+
affectedEl.querySelector( '.wptb-image-wrapper a' ).style.float = wptbImageFloatValue;
|
469 |
break;
|
470 |
case 'font-size':
|
471 |
affectedEl.style.fontSize = val + 'px';
|
inc/admin/js/core/WPTB_Initializer.js
CHANGED
@@ -2,8 +2,8 @@ var WPTB_Initializer = function () {
|
|
2 |
|
3 |
const MIN_COLUMNS = 1,
|
4 |
MIN_ROWS = 1,
|
5 |
-
MAX_COLUMNS =
|
6 |
-
MAX_ROWS =
|
7 |
|
8 |
var tableGenerator = document.body;
|
9 |
columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],
|
2 |
|
3 |
const MIN_COLUMNS = 1,
|
4 |
MIN_ROWS = 1,
|
5 |
+
MAX_COLUMNS = 30,
|
6 |
+
MAX_ROWS = 30;
|
7 |
|
8 |
var tableGenerator = document.body;
|
9 |
columnsDecrementButton = tableGenerator.getElementsByClassName('wptb-input-number-decrement')[0],
|
inc/admin/views/builder/wptb-builder-table-setup.php
CHANGED
@@ -23,10 +23,10 @@ use WP_Table_Builder as NS;
|
|
23 |
</tr>
|
24 |
<tr>
|
25 |
<td style="padding: 15px">
|
26 |
-
<span class="wptb-input-number-decrement">–</span><input class="wptb-input-number" id="wptb-columns-number" type="text" value="1" min="1" max="
|
27 |
</td>
|
28 |
<td style="padding: 15px">
|
29 |
-
<span class="wptb-input-number-decrement">–</span><input class="wptb-input-number" id="wptb-rows-number" type="text" value="1" min="1" max="
|
30 |
</td>
|
31 |
</tr>
|
32 |
<tr>
|
23 |
</tr>
|
24 |
<tr>
|
25 |
<td style="padding: 15px">
|
26 |
+
<span class="wptb-input-number-decrement">–</span><input class="wptb-input-number" id="wptb-columns-number" type="text" value="1" min="1" max="30"><span class="wptb-input-number-increment">+</span>
|
27 |
</td>
|
28 |
<td style="padding: 15px">
|
29 |
+
<span class="wptb-input-number-decrement">–</span><input class="wptb-input-number" id="wptb-rows-number" type="text" value="1" min="1" max="30"><span class="wptb-input-number-increment">+</span>
|
30 |
</td>
|
31 |
</tr>
|
32 |
<tr>
|
inc/frontend/class-frontend.php
CHANGED
@@ -77,11 +77,15 @@ class Frontend {
|
|
77 |
* class.
|
78 |
*/
|
79 |
|
80 |
-
|
81 |
|
82 |
}
|
|
|
|
|
|
|
|
|
83 |
|
84 |
-
|
85 |
* Register the JavaScript for the public-facing side of the site.
|
86 |
*
|
87 |
* @since 1.0.0
|
@@ -99,8 +103,12 @@ class Frontend {
|
|
99 |
* between the defined hooks and the functions defined in this
|
100 |
* class.
|
101 |
*/
|
102 |
-
|
103 |
|
104 |
}
|
|
|
|
|
|
|
|
|
105 |
|
106 |
}
|
77 |
* class.
|
78 |
*/
|
79 |
|
80 |
+
add_action( 'wptb_frontend_enqueue_style', array( $this, 'unqueue_styles_start' ) );
|
81 |
|
82 |
}
|
83 |
+
|
84 |
+
public function unqueue_styles_start() {
|
85 |
+
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wp-table-builder-frontend.css', array(), $this->version, 'all' );
|
86 |
+
}
|
87 |
|
88 |
+
/**
|
89 |
* Register the JavaScript for the public-facing side of the site.
|
90 |
*
|
91 |
* @since 1.0.0
|
103 |
* between the defined hooks and the functions defined in this
|
104 |
* class.
|
105 |
*/
|
106 |
+
add_action( 'wptb_frontend_enqueue_script', array( $this, 'unqueue_script_start' ) );
|
107 |
|
108 |
}
|
109 |
+
|
110 |
+
public function unqueue_script_start() {
|
111 |
+
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp-table-builder-frontend.js', array( 'jquery' ), $this->version, false );
|
112 |
+
}
|
113 |
|
114 |
}
|
languages/wp-table-builder.pot
CHANGED
@@ -32,19 +32,19 @@ msgstr ""
|
|
32 |
msgid "Add New"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: ../inc/admin/class-tables.php:
|
36 |
msgid "Edit"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: ../inc/admin/class-tables.php:
|
40 |
msgid "Shortcode"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: ../inc/admin/class-tables.php:
|
44 |
msgid "Title"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: ../inc/admin/class-tables.php:
|
48 |
msgid "Date"
|
49 |
msgstr ""
|
50 |
|
32 |
msgid "Add New"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: ../inc/admin/class-tables.php:37
|
36 |
msgid "Edit"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: ../inc/admin/class-tables.php:45, ../inc/admin/class-tables.php:50, ../inc/admin/class-wptb-listing.php:189
|
40 |
msgid "Shortcode"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: ../inc/admin/class-tables.php:49, ../inc/admin/class-wptb-listing.php:188
|
44 |
msgid "Title"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: ../inc/admin/class-tables.php:51
|
48 |
msgid "Date"
|
49 |
msgstr ""
|
50 |
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== WordPress Table Plugin - WP Table Builder ===
|
2 |
-
Contributors: imtiazrayhan
|
3 |
Tags: table, table builder, drag and drop
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.2
|
6 |
-
Stable tag: 1.0.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPL3+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
@@ -51,14 +51,31 @@ Please remember you MUST have PHP 5.6+ to be able to use this plugin.
|
|
51 |
|
52 |
That's it. You're done!
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
== Screenshots ==
|
55 |
|
56 |
-
1. Table
|
57 |
-
2.
|
58 |
-
3. Table
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
= 1.0.6 =
|
63 |
|
64 |
* FIX: Image Element not being added between Text and List element.
|
1 |
=== WordPress Table Plugin - WP Table Builder ===
|
2 |
+
Contributors: wptb, imtiazrayhan, istiakrayhan, ultimateblocks, wpcdplugin, wpleaders1
|
3 |
Tags: table, table builder, drag and drop
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.2
|
6 |
+
Stable tag: 1.0.7
|
7 |
Requires PHP: 5.6
|
8 |
License: GPL3+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
51 |
|
52 |
That's it. You're done!
|
53 |
|
54 |
+
## Join Us To Get Updates and Resources
|
55 |
+
|
56 |
+
* [Visit WP Table Builder Website](https://wptablebuilder.com/)
|
57 |
+
* [Follow Us on Twitter](https://twitter.com/wptbplugin/)
|
58 |
+
* [Join Our Facebook Group](https://www.facebook.com/groups/497986907442780/)
|
59 |
+
|
60 |
== Screenshots ==
|
61 |
|
62 |
+
1. Creating new table in WP Table Builder.
|
63 |
+
2. First Table In WP Table Builder.
|
64 |
+
3. Text In WP Table Builder.
|
65 |
+
4. Images In WP Table Builder.
|
66 |
+
5. Text 2 In WP Table Builder.
|
67 |
+
6. List Options In WP Table Builder.
|
68 |
+
7. Button In WP Table Builder.
|
69 |
+
8. Shortcode in WP Table Builder.
|
70 |
|
71 |
== Changelog ==
|
72 |
|
73 |
+
= 1.0.7 =
|
74 |
+
|
75 |
+
* FIX: Image alignment setting not working.
|
76 |
+
* NEW: Increased maximum number of Rows and Columns.
|
77 |
+
* IMPROVE: Performance improvement by loading assets only where necessary.
|
78 |
+
|
79 |
= 1.0.6 =
|
80 |
|
81 |
* FIX: Image Element not being added between Text and List element.
|
wp-table-builder.php
CHANGED
@@ -15,8 +15,8 @@
|
|
15 |
* Plugin Name: WP Table Builder
|
16 |
* Plugin URI: https://wptablebuilder.com/
|
17 |
* Description: Drag and Drop Table Builder Plugin for WordPress.
|
18 |
-
* Version: 1.0.
|
19 |
-
* Author:
|
20 |
* Author URI: https://imtiazrayhan.com//
|
21 |
* License: GPL-3.0+
|
22 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
@@ -39,7 +39,7 @@ define( __NAMESPACE__ . '\NS', __NAMESPACE__ . '\\' );
|
|
39 |
|
40 |
define( NS . 'WP_TABLE_BUILDER', 'wp-table-builder' );
|
41 |
|
42 |
-
define( NS . 'PLUGIN_VERSION', '1.0.
|
43 |
|
44 |
define( NS . 'WP_TABLE_BUILDER_DIR', plugin_dir_path( __FILE__ ) );
|
45 |
|
15 |
* Plugin Name: WP Table Builder
|
16 |
* Plugin URI: https://wptablebuilder.com/
|
17 |
* Description: Drag and Drop Table Builder Plugin for WordPress.
|
18 |
+
* Version: 1.0.7
|
19 |
+
* Author: WP Table Builder
|
20 |
* Author URI: https://imtiazrayhan.com//
|
21 |
* License: GPL-3.0+
|
22 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
39 |
|
40 |
define( NS . 'WP_TABLE_BUILDER', 'wp-table-builder' );
|
41 |
|
42 |
+
define( NS . 'PLUGIN_VERSION', '1.0.7' );
|
43 |
|
44 |
define( NS . 'WP_TABLE_BUILDER_DIR', plugin_dir_path( __FILE__ ) );
|
45 |
|