Version Description
- FIX: Image Element not being added between Text and List element.
- FIX: Accidental Closing of the editor. Gives warning before closing.
Download this release
Release Info
Developer | imtiazrayhan |
Plugin | WP Table Builder – WordPress Table Plugin |
Version | 1.0.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6
- inc/admin/css/admin.css +19 -0
- inc/admin/js/admin.js +45 -4
- inc/admin/js/admin.js.map +1 -1
- inc/admin/js/core/WPTB_DropHandle.js +5 -3
- inc/admin/js/core/WPTB_Settings.js +22 -1
- inc/admin/js/core/WPTB_TableStateSaveManager.js +22 -0
- inc/admin/views/builder/wptb-builder-header.php +1 -1
- readme.txt +6 -1
- wp-table-builder.php +2 -2
inc/admin/css/admin.css
CHANGED
@@ -184,6 +184,25 @@ body>img {
|
|
184 |
color: white;
|
185 |
}
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
.wptb-close {
|
188 |
background-color: #fff;
|
189 |
border-left: 1px solid #d3d3d3;
|
184 |
color: white;
|
185 |
}
|
186 |
|
187 |
+
.wptb-save-btn:focus {
|
188 |
+
color: white;
|
189 |
+
}
|
190 |
+
|
191 |
+
.wptb-save-btn.wptb-save-disabled {
|
192 |
+
cursor: not-allowed;
|
193 |
+
opacity: 0.5;
|
194 |
+
}
|
195 |
+
|
196 |
+
.wptb-save-btn.wptb-save-disabled:hover {
|
197 |
+
text-decoration: none;
|
198 |
+
}
|
199 |
+
|
200 |
+
.wptb-save-btn.wptb-save-disabled:focus {
|
201 |
+
box-shadow: none;
|
202 |
+
outline: none;
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
.wptb-close {
|
207 |
background-color: #fff;
|
208 |
border-left: 1px solid #d3d3d3;
|
inc/admin/js/admin.js
CHANGED
@@ -849,6 +849,7 @@ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
|
|
849 |
element = document.getElementsByClassName(e.dataTransfer.getData('node'))[0];
|
850 |
element.classList.remove('wptb-moving-mode');
|
851 |
element.classList.remove('wptb-moving-into-same-elem');
|
|
|
852 |
}
|
853 |
|
854 |
var td = void 0;
|
@@ -880,10 +881,11 @@ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
|
|
880 |
wptbDropBorderMarker.style.display = 'none';
|
881 |
|
882 |
WPTB_innerElementSet(element);
|
883 |
-
|
884 |
-
if (!element.classList.contains('wptb-image-container')) {
|
885 |
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
886 |
wptbTableStateSaveManager.tableStateSet();
|
|
|
887 |
}
|
888 |
};
|
889 |
var wptbContainer = document.querySelector('.wptb-container');
|
@@ -947,7 +949,7 @@ var WPTB_DropHandle = function WPTB_DropHandle(thisElem, e) {
|
|
947 |
if (thisElem.nodeName.toLowerCase() != 'td') {
|
948 |
var y = e.offsetY == undefined ? e.layerY : e.offsetY;
|
949 |
top = parseFloat(coordinatesElement.top) - parseFloat(11);
|
950 |
-
wptbDropHandle.dataset.text = '
|
951 |
if (y > height / 2) {
|
952 |
top = parseFloat(coordinatesElement.top) + height - 1;
|
953 |
wptbDropHandle.dataset.text = 'Below Element';
|
@@ -3003,6 +3005,15 @@ var WPTB_Settings = function WPTB_Settings() {
|
|
3003 |
}
|
3004 |
};
|
3005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3006 |
document.getElementsByClassName('wptb-popup-dark-area')[0].onclick = function () {
|
3007 |
shortcodePopupWindow.classList.remove('wptb-popup-show');
|
3008 |
};
|
@@ -3017,7 +3028,10 @@ var WPTB_Settings = function WPTB_Settings() {
|
|
3017 |
}
|
3018 |
};
|
3019 |
|
3020 |
-
document.getElementsByClassName('wptb-save-btn')[0].onclick = function () {
|
|
|
|
|
|
|
3021 |
var bar = document.querySelector('.wptb-edit-bar');
|
3022 |
if (bar && bar.classList.contains('visible')) {
|
3023 |
var table = document.getElementsByClassName('wptb-preview-table')[0];
|
@@ -3082,6 +3096,13 @@ var WPTB_Settings = function WPTB_Settings() {
|
|
3082 |
}
|
3083 |
} else if (data[0] == 'edited') {
|
3084 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3085 |
} else {
|
3086 |
messagingArea.innerHTML = '<div class="wptb-error wptb-message">Safety problems</div>';
|
3087 |
}
|
@@ -5123,6 +5144,16 @@ var WPTB_TableStateSaveManager = function WPTB_TableStateSaveManager() {
|
|
5123 |
|
5124 |
wptbRedo.classList.add('wptb-undoredo-disabled');
|
5125 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5126 |
}
|
5127 |
};
|
5128 |
|
@@ -5174,6 +5205,16 @@ var WPTB_TableStateSaveManager = function WPTB_TableStateSaveManager() {
|
|
5174 |
}
|
5175 |
}
|
5176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5177 |
// load necessary saved table state
|
5178 |
var wptbTableSetup = document.getElementsByClassName('wptb-table-setup');
|
5179 |
if (wptbTableSetup.length > 0) {
|
849 |
element = document.getElementsByClassName(e.dataTransfer.getData('node'))[0];
|
850 |
element.classList.remove('wptb-moving-mode');
|
851 |
element.classList.remove('wptb-moving-into-same-elem');
|
852 |
+
element.wptbMovingMode = 1;
|
853 |
}
|
854 |
|
855 |
var td = void 0;
|
881 |
wptbDropBorderMarker.style.display = 'none';
|
882 |
|
883 |
WPTB_innerElementSet(element);
|
884 |
+
console.log(element);
|
885 |
+
if (!element.classList.contains('wptb-image-container') || element.wptbMovingMode == 1) {
|
886 |
var wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
887 |
wptbTableStateSaveManager.tableStateSet();
|
888 |
+
element.wptbMovingMode == undefined;
|
889 |
}
|
890 |
};
|
891 |
var wptbContainer = document.querySelector('.wptb-container');
|
949 |
if (thisElem.nodeName.toLowerCase() != 'td') {
|
950 |
var y = e.offsetY == undefined ? e.layerY : e.offsetY;
|
951 |
top = parseFloat(coordinatesElement.top) - parseFloat(11);
|
952 |
+
wptbDropHandle.dataset.text = 'Above Element';
|
953 |
if (y > height / 2) {
|
954 |
top = parseFloat(coordinatesElement.top) + height - 1;
|
955 |
wptbDropHandle.dataset.text = 'Below Element';
|
3005 |
}
|
3006 |
};
|
3007 |
|
3008 |
+
window.onbeforeunload = function (e) {
|
3009 |
+
var wptbSaveDisabled = document.getElementsByClassName('wptb-save-disabled');
|
3010 |
+
if (wptbSaveDisabled.length == 0) {
|
3011 |
+
return true;
|
3012 |
+
} else {
|
3013 |
+
return null;
|
3014 |
+
}
|
3015 |
+
};
|
3016 |
+
|
3017 |
document.getElementsByClassName('wptb-popup-dark-area')[0].onclick = function () {
|
3018 |
shortcodePopupWindow.classList.remove('wptb-popup-show');
|
3019 |
};
|
3028 |
}
|
3029 |
};
|
3030 |
|
3031 |
+
document.getElementsByClassName('wptb-save-btn')[0].onclick = function (event) {
|
3032 |
+
if (!event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 || window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave) {
|
3033 |
+
return;
|
3034 |
+
}
|
3035 |
var bar = document.querySelector('.wptb-edit-bar');
|
3036 |
if (bar && bar.classList.contains('visible')) {
|
3037 |
var table = document.getElementsByClassName('wptb-preview-table')[0];
|
3096 |
}
|
3097 |
} else if (data[0] == 'edited') {
|
3098 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
|
3099 |
+
event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;
|
3100 |
+
|
3101 |
+
var wptbSaveBtn = document.getElementsByClassName('wptb-save-btn');
|
3102 |
+
if (wptbSaveBtn.length > 0) {
|
3103 |
+
wptbSaveBtn = wptbSaveBtn[0];
|
3104 |
+
wptbSaveBtn.classList.add('wptb-save-disabled');
|
3105 |
+
}
|
3106 |
} else {
|
3107 |
messagingArea.innerHTML = '<div class="wptb-error wptb-message">Safety problems</div>';
|
3108 |
}
|
5144 |
|
5145 |
wptbRedo.classList.add('wptb-undoredo-disabled');
|
5146 |
}
|
5147 |
+
|
5148 |
+
var wptbSaveBtn = document.getElementsByClassName('wptb-save-btn');
|
5149 |
+
if (wptbSaveBtn.length > 0) {
|
5150 |
+
wptbSaveBtn = wptbSaveBtn[0];
|
5151 |
+
if (!wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 || window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave) {
|
5152 |
+
wptbSaveBtn.classList.add('wptb-save-disabled');
|
5153 |
+
} else {
|
5154 |
+
wptbSaveBtn.classList.remove('wptb-save-disabled');
|
5155 |
+
}
|
5156 |
+
}
|
5157 |
}
|
5158 |
};
|
5159 |
|
5205 |
}
|
5206 |
}
|
5207 |
|
5208 |
+
var wptbSaveBtn = document.getElementsByClassName('wptb-save-btn');
|
5209 |
+
if (wptbSaveBtn.length > 0) {
|
5210 |
+
wptbSaveBtn = wptbSaveBtn[0];
|
5211 |
+
if (!wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 || window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave) {
|
5212 |
+
wptbSaveBtn.classList.add('wptb-save-disabled');
|
5213 |
+
} else {
|
5214 |
+
wptbSaveBtn.classList.remove('wptb-save-disabled');
|
5215 |
+
}
|
5216 |
+
}
|
5217 |
+
|
5218 |
// load necessary saved table state
|
5219 |
var wptbTableSetup = document.getElementsByClassName('wptb-table-setup');
|
5220 |
if (wptbTableSetup.length > 0) {
|
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","getDOMParentElement","nodeName","toLowerCase","innerElement","innerElementNext","onscroll","indics","types","notDragEnter","indexOf","elementDrag","offsetY","layerY","bottom","priv","key","elemIdClass","prop","properties","affectedEl","wptbSize","b","buttonAlignment","justifyContent","buttonAlignmentSelect","selectOption","selectOptionVal","selected","buttonHref","getAttribute","buttonLinkTarget","buttonId","buttonHrefInput","buttonLinkTargetInput","buttonLinkTargetInputId","buttonLinkTargetInputLabel","buttotIdInput","checked","buttonTextColor","color","buttonColor","backgroundColor","buttonTextColorInput","buttonBackgroundColorInput","rgbToHex","wptbImageWrapper","imgAlign","textAlign","imageAlignmentSelect","elementsA","imageLinkHref","inputImageLink","imageLinkTarget","imageLinkTargetInput","imageLinkTargetInputId","imageLinkTargetInputLabel","imgWidth","imageWidthInputRange","imageWidthInputNumber","img","imgAlternativeText","imageAlternativeTextInput","elementFontSize","fontSize","elementTextColor","textFontSizeInputRange","textFontSizeInputNumber","textColorInput","elementList","elementListColor","listColorInput","elementListItem","listItemP","listItemPClasses","elementListClassSelect","listIconSelectLabel","nodeType","listIconSelectLabelId","elementListStyleTypeSelect","elementListItemContent","listItemPTextAlignArr","p","listItemPTextAlignLeftCount","listItemPTextAlignCenterCount","listItemPTextAlignRightCount","elementListAlignmentSelect","maxListItemTAlLeftC","optionsClass","children","buttons","size","n_Class","num","optionControls","wpColorPicker","change","ui","classe","ps","number","toString","wpColorPickerCheckChangeForTableStateSaving","slider","oninput","onchange","src","alt","href","linkHttpCheckChange","rel","removeAttribute","jc","id","parentNodeSettingItem","onmouseup","hexToRgb","hex","result","exec","rgb","slice","getDragImageCustom","hostName","location","protocol","hostname","image","button","list","ulElem","par","listStyleTypeIndex","Number","article","keyCode","innerText","pText","replace","trim","selectedText","getSelectionText","wptbListItem","wptbButtonContainer","link","linkArr","linkClean","rows","rowHead","computedStyleRowHead","rowHeadChildren","contentsForHeader","tdElements","textContent","thisRowChildren","wptbTitleColumn","wptbTitleColumnFontSize","wptbTitleColumnColor","wptbTitleBackgroundColor","wptbTitleAlign","cls","parentElement","txt","getSelection","selection","createRange","settingsPanelClear","wpColorPickerClear","elementOptionsPanelClear","elementOptionsGroup","originalEvent","wpPickerContainer","irisSquareHandle","uiSliderHandle","attribute","isId","input","newInput","url","results","decodeURIComponent","getColumnWidth","cell","xIndexes","cellWidth","getRowHeight","yIndexes","cellHeight","elImage","anchor","file_frame","wp","media","frames","title","multiple","attachment","state","get","first","toJSON","imgSrc","MIN_COLUMNS","MIN_ROWS","MAX_COLUMNS","MAX_ROWS","tableGenerator","columnsDecrementButton","columnsIncrementButton","rowsDecrementButton","rowsIncrementButton","columnsInput","rowsInput","columns","div","classId","stopPropagation","onmouseover","wptbElementButtons","wptbTdBgColorSavedSet","inputId","trNumber","tableRows","trBackgroundColor","wptbEvenRowBg","console","log","clear","tableHeader","tableAdaptiveForMobile","wptbAdaptiveTableCheckbox","wptbAdaptiveTable","tableTopRowAsHeadSavedSet","wptbTopRowAsHeader","tableBorderColorWidthSavedSet","tableBorderColor","borderColor","tableBorderColorInput","tableBorderWidth","borderWidth","wptbTableBorderWidthSlider","wptbTableBorderWidthNumber","tableTd","applyInnerBorder","innerBorderCheckInput","wptbApplyInnerBorder","wptbTableInnerBorderSlider","wptbTableInnerBorderNumber","tableCells","tableInnerborderNumber","addInnerBorderSize","borderStyle","addCellPadding","addInnerBorder","styles","wptbPreviewTable","marginBottom","addBorderSize","cellPaddingSavedSet","wptbTableCellSlider","wptbTableCellNumber","numberImputSize","wptbNumberInputs","maxCount","maxValue","onkeydown","thisValue","String","substring","onkeyup","wptbTableBorderNumber","wptbTextfontSizeNumber","wptbImageWidthNumber","wptbTableColumnWidthNumber","wptbTableRowHeightNumber","tdDefaultWidth","wptbInnerBorderCheck","tableBorderColorSetArea","addColumnWidth","highlighted","addRowHeight","createMobileHeadForTable","thisEvent","wptbElement","toggleTableEditMode","addRowToTheEnd","addRowToTheStart","addRowBefore","addRowAfter","addColumnEnd","addColumnStart","addColumnBefore","addColumnAfter","deleteColumn","deleteRow","mergeCells","splitCell","wptbBuilderPanel","clickOnFreeSpace","wptbHeader","wpcdFixedToolbar","hasAttribute","innerElements","el_L","wptbListItemReturn","styleDot","listItemKeyListener","selectedCells","multipleCellMode","activateMultipleSelectMode","deactivateMultipleSelectMode","isActivated","pushSelectedCell","flushSelectedCells","getFirst","minXIndex","minYIndex","getLast","maxXIndex","maxYIndex","last","removeAllButFirst","code","columnTitleMobile","WPTB_Parser2","elementHtml","createTextNode","tagName","elems","ondragend","wptbUndo","tableStateGet","wptbUndoredo","wptbUndoRedoContainer","wptbRedo","shortcodePopupWindow","bar","wptb_admin_object","t","messagingArea","WPTB_Stringifier","outerHTML","messagingAreaText","params","security_code","rs","wptbId","stringify","data","wptbPreviewBtn","wptbPreviewBtnHref","previewHref","elSpaceBetween","spaceBetween","t_space","spaceParent","alert","codeMain","tableColumns","minWidth","maxWidth","mceContentBodys","k","dataMceStyle","contentEditable","spellCheck","mceIds","wptbActionsLength","columnNameDivContainer","columnNameDiv","WPTB_Stringifier2","start","nodeValue","int_elem_arr","attributes_list","internal_elements","inter_elem","array","wptbTableSetup","maxAmountOfCells","maxAmountOfRows","mark","rowSpan","cs","colSpan","markedCells","noCells","singleCells","multipleCells","cellSettings","column","cellHighlighted","wptbTableColumnWidthSlider","tableColumnWidthAutoFixedCheckbox","wptbFixedWidth","wptbTableRowHeightSlider","tableRowHeightAutoFixedCheckbox","wptbFixedHeight","isSquare","realTimeArray","carried","cols","matriz","items","justAssigned","amount","carriedRowspans","cellsBuffer","cellPointer","xPosition","stepsToMove","celda","drawTable","string","undoSelect","fillTableArray","colspansSums","cells","colspanSumInRow","apply","getActualPointsInRow","points","search","skipInCols","reconstraction","insertRow","wptb_preview_table","cellModeBackground","leftScrollPanelCurtain","leftScrollPanelCellSettings","wptbPreviewTableTds","recalculateIndexes","trs","maxCols","maxColsFull","tdsArr","jMainIter","z","cleaner","dataXIndex","tableTdsFor","colspan","widthIsSet","arrayTdsFromPreviousRow","tableTdsSumMaxWidth","tableTdsSumMaxWidthFixed","tableTdsSumMaxWidthAuto","wptbTableSetupWidth","arrayCellsWidthFixedHelper","arrayCellsWidthAutoHelper","tdPaddingCommon","tableTdBorderCommonWidth","cssForTdsWidthAuto","wptbCssTdAutoWidth","tableTdBorderLeftWidth","tableTdBorderRightWidth","CellsWidthAutoCount","tableFullStyleObj","borderLeftWidth","borderRightWidth","tableBorderCommon","wptbTableTdsSumMaxWidth","wptbCellsWidthAutoCount","mergingСellsHorizontally","wptbFixedWidthSize","styleElementCreate","tableTdWidthAuto","tableTdsWidthAutoCommon","head","cssForTdsWidthAutoOld","dataYIndex","rowspan","heightIsSet","arrayTdsPrevious","tableColumnHeightAutoFixedCheckbox","wptbAdaptiveTableChoseBlock","mergingCellsVertically","forBreak","currentTable","currentTableTd","currentTdStyle","firstCell","c_pos","cellStyle","pos","pendingInsertion","bro","currentCell","l","r","aux","from","cellNew","rowChildren","rowChildrenLength","cellRowSpan","rowAfter","cellsColSpan","tableRowsIChildren","tableRIChildrenLength","rowIRowSpan","rNext","rNextChildren","rNextChildrenLength","rowStart","columnStart","rowEnd","columnEnd","itemsEstimate","dimensions","call","tdsChildrenNew","tdsInternalElements","tdsIntElemLength","firstWidth","firstDataFixedWidth","firstHeight","firstDataFixedHeight","cellStyles","cellXIndex","rowChildInsertBefore","rowNext","findRowspannedCells","difference","actualPoints","addLackingCells","sumRows","totalColspan","nextRow","nextRowChildren","nextRowChildrenLength","tdArr","nextRowChildrenK","jRowChildren","pop","onresize","wptbTableStateSaving","wptbTableStateNumberShow","wptbNewPreviewTable","wptbHighlighted","cssForTdsWidthAutoValue","datawptbUndoredo","wptbLeftScrollPanelCellSetting","elText2","elP"],"mappings":"AAAA,IAAIA,2BAA2B,SAA3BA,wBAA2B,CAAWC,OAAX,EAAoBC,aAApB,EAAkD;AAAA,QAAfC,IAAe,uEAAR,KAAQ;;AAC7E,QAAIC,OAAOH,QAAQI,aAAR,EAAX;AAAA,QACIC,KADJ;AAAA,QAEIC,SAFJ;AAAA,QAGIJ,IAHJ;;AAKA,QAAKD,iBAAiBM,SAAjB,IAA8BL,QAAQ,IAA3C,EAAkD;AAC9CG,gBAAQG,SAASC,OAAT,CAAiBC,SAAjB,CAA4BV,QAAQW,IAApC,CAAR;AACA,YAAIC,eAAeJ,SAASK,sBAAT,CAAiC,iBAAjC,CAAnB;AACA,YAAIC,oBAAoB,EAAxB;AACA,aAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIH,a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WzE,MAA/B,EAAuCD,GAAvC,EAA6C;AACzCuL,uBAAWS,YAAX,CAAwBtH,WAAW1E,CAAX,EAAciM,IAAtC,EAA4CvH,WAAW1E,CAAX,EAAcyK,KAA1D;AACH;AACJ;;AAED,SAAK7K,IAAL,GAAY,MAAZ;AACA,SAAKP,aAAL,GAAqB,YAAY;AAC7B,eAAOkM,UAAP;AACH,KAFD;AAGAvM,6BAA0B,IAA1B,EAAgCE,aAAhC,EAA+CC,IAA/C;;AAEA,WAAO,IAAP;AACH,CAhCD","file":"admin.js","sourcesContent":["var applyGenericItemSettings = function ( element, kindIndexProt, copy = false ) {\r\n var node = element.getDOMElement(),\r\n index,\r\n listItems,\r\n copy;\r\n \r\n if ( kindIndexProt == undefined || copy == true ) {\r\n index = document.counter.nextIndex( element.kind );\r\n let wptbElements = document.getElementsByClassName( 'wptb-ph-element' );\r\n let elementIndexesArr = [];\r\n for( let i = 0; i < wptbElements.length; i++ ) {\r\n var regex = new RegExp( 'wptb-element-' + element.kind + '-(\\\\d+)', \"i\" );\r\n let infArr = wptbElements[i].className.match( regex );\r\n if( infArr ) {\r\n elementIndexesArr.push( infArr[1] );\r\n }\r\n }\r\n if( elementIndexesArr.length > 0 ) {\r\n let elementIndexMax = Math.max( ...elementIndexesArr );\r\n index = elementIndexMax + 1;\r\n } else { \r\n index = 1;\r\n }\r\n } else if ( kindIndexProt && ! copy ) {\r\n index = kindIndexProt.split('-')[1];\r\n }\r\n \r\n node.onmouseenter = function ( event ) {\r\n if( event.target.classList.contains( 'wptb-moving-mode' ) ) {\r\n return;\r\n }\r\n \r\n let i, wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n node.classList.remove( 'wptb-ondragenter' );\r\n \r\n //wptbActionsField.addActionField( 1, node )\r\n \r\n if ( element.kind === 'button' ) {\r\n let a = node.querySelector( 'a' ),\r\n target = a.querySelector( 'div' );\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n WPTB_Helper.buttonsTinyMceInit( target );\r\n } else if (element.kind === 'text') {\r\n tinyMCE.init({\r\n target: node.childNodes[0],\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup : function( ed ) {\r\n ed.on( 'change', function(e) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n \r\n });\r\n \r\n ed.on( 'keydown', function(e) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n });\r\n ed.on( 'keyup', function(e) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n wptbActionsField.addActionField( 1, node );\r\n \r\n wptbActionsField.setParameters( node );\r\n \r\n e.target.onblur = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n });\r\n \r\n },\r\n init_instance_callback: function (editor) {\r\n window.currentEditor = editor;\r\n //editor.fire('focus');\r\n editor.on('focus', function (e) {\r\n var totalWidth = document.getElementsByClassName('wptb-builder-panel')[0].offsetWidth;\r\n if (window.currentEditor &&\r\n document.getElementById('wptb_builder').scrollTop >= 55 &&\r\n window.currentEditor.bodyElement.style.display != 'none') {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'fixed';\r\n document.getElementById('wpcd_fixed_toolbar').style.right = (totalWidth / 2 - document.getElementById('wpcd_fixed_toolbar').offsetWidth / 2) + 'px';\r\n document.getElementById('wpcd_fixed_toolbar').style.top = '100px';\r\n } else {\r\n document.getElementById('wpcd_fixed_toolbar').style.position = 'static';\r\n delete document.getElementById('wpcd_fixed_toolbar').style.right;\r\n delete document.getElementById('wpcd_fixed_toolbar').style.top;\r\n }\r\n });\r\n }\r\n });\r\n \r\n } else {\r\n listItems = node.getElementsByClassName( 'wptb-list-item-content' );\r\n for ( let i = 0; i < listItems.length; i++ ) {\r\n WPTB_Helper.listItemsTinyMceInit( listItems[i] );\r\n }\r\n }\r\n\r\n \r\n };\r\n \r\n node.onmouseleave = function ( event ) {\r\n let wptbActionsField = new WPTB_ActionsField();\r\n \r\n if( wptbActionsField.wptbActions && wptbActionsField.wptbActions.type != '1' ) {\r\n return;\r\n }\r\n \r\n wptbActionsField.leaveFromField( event, node, 1 );\r\n };\r\n \r\n let wptbActions = document.getElementsByClassName( 'wptb-actions' );\r\n if( wptbActions.length > 0 ) {\r\n wptbActions = wptbActions[0];\r\n \r\n }\r\n \r\n // Change data-title-column if the title was changed\r\n if( element.kind == 'text' ) {\r\n var observer = new MutationObserver( function( mutations ) {\r\n let row = WPTB_Helper.findAncestor( node, 'wptb-row' );\r\n if( row.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( row, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n });\r\n var config = { attributes: true, attributeFilter: ['style'] };\r\n observer.observe( element.getDOMElement(), config );\r\n }\r\n\r\n let node_wptb_element_kind_num = node.className.match(/wptb-element-(.+)-(\\d+)/i);\r\n if ( node_wptb_element_kind_num ) {\r\n node.classList.remove( node_wptb_element_kind_num[0] );\r\n }\r\n if ( ! node.classList.contains( 'wptb-ph-element' ) ) {\r\n node.classList.add( 'wptb-ph-element' );\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n } else {\r\n if( ! node.classList.contains( 'wptb-element-' + element.kind + '-' + index ) ) {\r\n node.classList.add( 'wptb-element-' + element.kind + '-' + index );\r\n }\r\n }\r\n new WPTB_ElementOptions( element, index, kindIndexProt );\r\n\r\n document.counter.increment(element.kind);\r\n};","","var WPTB_ActionsField = function() {\n //this.wptbBorderMarker;\n this.wptbActions;\n if( document.getElementsByClassName( 'wptb-actions' ).length != 0 ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n \n this.addActionField = ( actionType, thisNode ) => {\n let body = document.getElementsByTagName( 'body' )[0];\n \n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length != 0 ) {\n let previousNode = actions[0].activeElem;\n if( previousNode ) {\n previousNode.classList.remove( 'wptb-directlyhovered' );\n }\n \n while( actions.length != 0 ) {\n actions[0].parentNode.removeChild( actions[0] );\n }\n }\n \n if( actionType == 1 ) {\n \n let btnDelete, btnCopy, btnMove;\n\n btnDelete = document.createElement( 'span' ),\n btnCopy = document.createElement( 'span' ),\n btnMove = document.createElement( 'span' ),\n actions = document.createElement( 'div' );\n\n actions.classList.add( 'wptb-actions' );\n btnDelete.classList.add( 'dashicons', 'dashicons-trash', 'wptb-delete-action' );\n btnCopy.classList.add( 'dashicons', 'dashicons-admin-page', 'wptb-duplicate-action' );\n btnMove.classList.add( \"dashicons\", \"dashicons-move\", 'wptb-move-action' );\n btnMove.draggable = true;\n\n actions.appendChild( btnMove );\n actions.appendChild( btnCopy );\n actions.appendChild( btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n\n actions.type = 1;\n\n btnDelete.onclick = function( event ) {\n let act = event.target.parentNode.activeElem,\n el = act.parentNode;\n el.removeChild(act);\n\n if( act.kind == 'text' ) {\n let thisRow = el.parentNode\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.actionsRemove();\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n\n\n btnCopy.onclick = ( event ) => {\n let copy,\n infArr,\n type;\n let activeElement = event.target.parentNode.activeElem;\n let activeElementClone = activeElement.cloneNode( true );\n activeElementClone.classList.remove( 'wptb-directlyhovered' );\n infArr = activeElement.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n let td = activeElement.parentNode;\n if ( type == 'list' ) {\n var temp = [],\n srcList = activeElement.querySelectorAll('ul li .wptb-list-item-content');\n\n for (var i = 0; i < srcList.length; i++) {\n temp.push(srcList[i].innerHTML);\n }\n\n copy = new WPTB_List( temp, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'text' ) {\n copy = new WPTB_Text( activeElementClone.childNodes[0].innerHTML, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else if ( type == 'image' ) {\n copy = new WPTB_Image( '', activeElement );\n \n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n } else {\n let text = activeElementClone.childNodes[0].querySelector( 'p' ).innerHTML;\n\n copy = new WPTB_Button( text, activeElementClone );\n\n td.insertBefore( copy.getDOMElement(), activeElement.nextSibling );\n }\n\n WPTB_innerElementSet( copy.getDOMElement() );\n\n let wptbActionsField = new WPTB_ActionsField( 1, activeElement );\n \n wptbActionsField.setParameters( activeElement );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnMove.ondragstart = ( event ) => {\n let dragImagesArr = WPTB_Helper.dragImagesArr(),\n actions = event.target.parentNode,\n activeElem = actions.activeElem,\n infArr,\n type;\n infArr = activeElem.className.match(/wptb-element-(.+)-(\\d+)/i);\n type = infArr[1];\n activeElem.classList.add( 'wptb-moving-mode' );\n\n event.dataTransfer.effectAllowed = 'move';\n event.dataTransfer.setDragImage( dragImagesArr[type], 0, 0 );\n event.dataTransfer.setData( 'node', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptb-moving-mode', 'wptb-element-' + infArr[1] + '-' + infArr[2] );\n event.dataTransfer.setData( 'wptbElIndic-' + infArr[1], 'wptbElIndic-' + infArr[1] );\n let act = event.target.parentNode.activeElem;\n if( act.kind == 'text' ) {\n let thisRow = act.parentNode.parentNode;\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\n WPTB_Helper.dataTitleColumnSet( table );\n }\n }\n //actions.style.display = 'none';\n this.actionsHide();\n };\n\n //actions.style.right = '-' + parseFloat( thisNode.offsetWidth ) + 'px';\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n } else if( actionType == 2 ) {\n let btnDelete,\n btnCopy,\n previous,\n i;\n\n btnDelete = document.createElement('span'),\n btnCopy = document.createElement('span'),\n actions = document.createElement('span')\n\n actions.classList.add('wptb-actions');\n btnDelete.classList.add('dashicons', 'dashicons-trash', 'wptb-delete-action');\n btnCopy.classList.add('dashicons', 'dashicons-admin-page', 'wptb-duplicate-action');\n\n actions.append( btnCopy, btnDelete );\n body.appendChild( actions );\n\n actions.activeElem = thisNode;\n \n let wptbDirectlyhovered = WPTB_Helper.findAncestor( thisNode, 'wptb-directlyhovered' );\n if( wptbDirectlyhovered ) {\n wptbDirectlyhovered.classList.remove( 'wptb-directlyhovered' );\n }\n\n actions.type = 2;\n\n btnDelete.onclick = ( event ) => {\n var action = event.target.parentNode, \n item = action.activeElem,\n parent = item.parentNode;\n let wptbActionsField = new WPTB_ActionsField( 4 );\n wptbActionsField.actionsRemove();\n parent.removeChild( item );\n WPTB_Helper.listItemsRecalculateIndex( parent );\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n btnCopy.onclick = ( event ) => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopBegin = coordinatesElement.top;\n\n var listItem = event.target.parentNode.activeElem,\n content = listItem.querySelector( '.wptb-list-item-content' ),\n html = content.innerHTML;\n var duplicate = new WPTB_ListItem( html, listItem, true );\n listItem.parentNode.insertBefore( duplicate.getDOMElement(), thisNode.nextSibling );\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\n\n let divcontent = thisNode.getElementsByClassName( 'wptb-list-item-content' );\n if( divcontent.length > 0 ) {\n divcontent = divcontent[0];\n }\n setTimeout( function(){\n divcontent.innerHTML = html;\n WPTB_Helper.listItemsRecalculateIndex( listItem.parentNode );\n }, 5 );\n\n coordinatesElement = thisNode.getBoundingClientRect();\n let coordinatesElementTopEnd = coordinatesElement.top;\n\n if( coordinatesElementTopBegin != coordinatesElementTopEnd ) {\n let wptbActionsField = new WPTB_ActionsField( 2, thisNode );\n wptbActionsField.setParameters( thisNode );\n }\n \n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\n wptbTableStateSaveManager.tableStateSet();\n };\n\n actions.style.display = 'block';\n\n this.wptbActions = actions;\n }\n }\n \n this.setParameters = ( thisNode ) => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.display = 'block';\n }\n \n let coordinatesElement = thisNode.getBoundingClientRect();\n \n let wptbContainer = document.getElementsByClassName( 'wptb-container' )[0];\n let correctTop = () => {\n let coordinatesElement = thisNode.getBoundingClientRect();\n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n }\n wptbContainer.removeEventListener( 'scroll', correctTop, false );\n \n this.wptbActions.style.top = parseFloat( coordinatesElement.top ) - 15 + 'px';\n this.wptbActions.style.left = ( parseFloat( coordinatesElement.right ) - parseFloat( this.wptbActions.clientWidth ) ) + 1 + 'px';\n\n// let wptbBorderMarkerTop = this.wptbBorderMarker.querySelector( '.wptb-border-marker-top' );\n// wptbBorderMarkerTop.style.width = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerRight = this.wptbBorderMarker.querySelector( '.wptb-border-marker-right' );\n// wptbBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 4 ) + 'px';\n// wptbBorderMarkerRight.style.left = ( parseFloat( thisNode.offsetWidth ) + 3 ) + 'px';\n//\n// let wptbBorderMarkerBottom = this.wptbBorderMarker.querySelector( '.wptb-border-marker-bottom' );\n// wptbBorderMarkerBottom.style.width = wptbBorderMarkerTop.style.width;\n// wptbBorderMarkerBottom.style.top = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) + 3 ) + 'px';;\n//\n// let wptbBorderMarkerLeft = this.wptbBorderMarker.querySelector( '.wptb-border-marker-left' );\n// \n \n //this.wptbBorderMarker.style.display = 'block';\n this.wptbActions.style.display = 'block';\n thisNode.classList.add( 'wptb-directlyhovered' );\n \n wptbContainer.addEventListener( 'scroll', correctTop, false );\n }\n \n// if( actionType == 1 || actionType == 2 ) {\n// this.setParameters( thisNode );\n// }\n// } else {\n// this.wptbActions.style.display = 'block';\n// thisNode.classList.add( 'wptb-directlyhovered' );\n// }\n \n this.leaveFromField = ( event, node, actionType ) => {\n if( event.relatedTarget ) {\n if ( event.relatedTarget.classList.contains( 'wptb-actions' ) ||\n event.relatedTarget.classList.contains( 'wptb-move-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-duplicate-action' ) ||\n event.relatedTarget.classList.contains( 'wptb-delete-action' ) ) {\n if( ! this.wptbActions ) {\n this.wptbActions = document.getElementsByClassName( 'wptb-actions' )[0];\n }\n this.wptbActions.onmouseleave = ( event ) => {\n if( event.relatedTarget != null && event.relatedTarget != this.wptbActions.activeElem &&\n WPTB_Helper.findAncestor( event.relatedTarget, 'wptb-directlyhovered') != this.wptbActions.activeElem ) {\n event.target.activeElem.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n\n if( this.wptbActions.type == 2 ) {\n let wptbActionsField = new WPTB_ActionsField();\n\n wptbActionsField.addActionField( 1, event.relatedTarget.parentNode.parentNode );\n\n wptbActionsField.setParameters( event.relatedTarget.parentNode.parentNode );\n }\n } else {\n return;\n }\n }\n\n return;\n } \n// else if( event.relatedTarget.classList.contains( 'wptb-drop-handle' ) ) {\n// let wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' );\n// if( wptbDropHandle.length > 0 ) {\n// wptbDropHandle = wptbDropHandle[0];\n// wptbDropHandle.onmouseleave\n// }\n// }\n }\n \n node.classList.remove( 'wptb-directlyhovered' );\n this.wptbActions.style.display = 'none';\n \n if( this.wptbActions.type == 2 ) {\n if( event.relatedTarget ) {\n if( event.relatedTarget.localName == 'ul' ) {\n //let wptbActionsField = new WPTB_ActionsField();\n\n this.addActionField( 1, event.relatedTarget.parentNode );\n\n this.setParameters( event.relatedTarget.parentNode );\n }\n }\n \n }\n }\n \n this.actionsRemove = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.parentNode.removeChild( this.wptbActions );\n }\n }\n \n this.actionsHide = () => {\n if( ! this.wptbActions ) {\n let actions = document.getElementsByClassName( 'wptb-actions' );\n if( actions.length > 0 ) {\n this.wptbActions = actions[0];\n }\n }\n \n if( this.wptbActions ) {\n this.wptbActions.style.opacity = 0;\n }\n }\n}","(function () {\r\n var WPTB_Builder = function () {\r\n var table_id = WPTB_Helper.detectMode();\r\n if ( table_id ) {\r\n var http = new XMLHttpRequest(),\r\n urlSet = ajaxurl + \"?action=get_table\" + '&id=' + table_id;\r\n http.open('GET', urlSet, true);\r\n http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\r\n http.onreadystatechange = function (d) {\r\n if (this.readyState == 4 && this.status == 200) {\r\n var ans = JSON.parse(http.responseText);\r\n document.getElementById('wptb-setup-name').value = ans[0];\r\n \r\n if( ans[1] ) {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n let wptbTableSetupEl = document.getElementsByClassName('wptb-table-setup')[0];\r\n wptbTableSetupEl.appendChild( WPTB_Parser( ans[1] ) );\r\n WPTB_Table();\r\n WPTB_LeftPanel();\r\n WPTB_Settings();\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n return;\r\n }\r\n };\r\n http.send(null);\r\n } else {\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n document.counter = new ElementCounters();\r\n document.select = new MultipleSelect();\r\n\r\n var initializer = WPTB_Initializer();\r\n settings = WPTB_Settings();\r\n };\r\n\r\n document.addEventListener('DOMContentLoaded', WPTB_Builder);\r\n})();","var WPTB_Button = function( text, DOMElementProt ) {\r\n \r\n var DOMElement = document.createElement('div'),\r\n elButton = document.createElement('div'),\r\n el_B = document.createElement('a'),\r\n el_BDiv = document.createElement( 'div' ),\r\n el_BDivP = document.createElement( 'p' ),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n\r\n DOMElement.classList.add('wptb-button-container', 'wptb-size-M', 'wptb-');\r\n elButton.classList.add('wptb-button-wrapper');\r\n el_BDiv.classList.add('wptb-button');\r\n el_BDivP.innerHTML = text != undefined ? text : 'Button Text';\r\n \r\n // Creation of a new button when copying to avoid errors when assigning new event handlers.\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n }; \r\n var attributesContainer = [...DOMElementProt.attributes];\r\n if ( attributesContainer.length > 0 ) {\r\n for( let i = 0; i < attributesContainer.length; i++ ) {\r\n DOMElement.setAttribute(attributesContainer[i].name, attributesContainer[i].value);\r\n } \r\n }\r\n \r\n var wptbButtonWrapper = DOMElementProt.querySelector( '.wptb-button-wrapper' );\r\n if ( wptbButtonWrapper ) {\r\n var wptbButtonWrapAttributes = [...wptbButtonWrapper.attributes];\r\n if ( wptbButtonWrapAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonWrapAttributes.length; i++ ) {\r\n if ( wptbButtonWrapAttributes[i].name == 'style') {\r\n elButton.setAttribute( wptbButtonWrapAttributes[i].name, wptbButtonWrapAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButtonA = DOMElementProt.querySelector( 'a' );\r\n if ( wptbButtonA ) {\r\n var wptbButtonAttributes = [...wptbButtonA.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style' || \r\n wptbButtonAttributes[i].name == 'href' || \r\n wptbButtonAttributes[i].name == 'target' ) {\r\n el_B.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n \r\n var wptbButton = DOMElementProt.querySelector( '.wptb-button' );\r\n if ( wptbButton ) {\r\n var wptbButtonAttributes = [...wptbButton.attributes];\r\n if ( wptbButtonAttributes.length > 0 ) {\r\n for( let i = 0; i < wptbButtonAttributes.length; i++ ) {\r\n if ( wptbButtonAttributes[i].name == 'style') {\r\n el_BDiv.setAttribute( wptbButtonAttributes[i].name, wptbButtonAttributes[i].value );\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n elButton.appendChild(el_B);\r\n el_B.appendChild( el_BDiv );\r\n el_BDiv.appendChild( el_BDivP );\r\n DOMElement.appendChild(elButton);\r\n \r\n \r\n \r\n this.kind = 'button';\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n \r\n return this;\r\n};","var WPTB_Cell = function (callback, DOMElement) {\r\n\r\n function highlightRow(td) {\r\n var parentRow = td.parentNode,\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value),\r\n tds = document.getElementsByClassName('wptb-preview-table')[0].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n tds[i].classList.remove('wptb-highlighted-row-first', 'wptb-highlighted-row-last', 'wptb-highlighted-row-inner', 'wptb-highlighted-column-first', 'wptb-highlighted-column-last', 'wptb-highlighted-column-inner');\r\n }\r\n for (var i = 0; i < columnCount; i++) {\r\n\r\n var classToAdd = i == 0 ? 'wptb-highlighted-row-first' : i == columnCount - 1 ? 'wptb-highlighted-row-last' : 'wptb-highlighted-row-inner';\r\n var ttd = parentRow.getElementsByTagName('td')[i];\r\n if (ttd !== td) {\r\n ttd.classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n\r\n function highlightColumn(td) {\r\n\r\n var index,\r\n parentRow = td.parentNode;\r\n columnCount = parseInt(document.getElementById('wptb-columns-number').value), rowCount = parseInt(document.getElementById('wptb-rows-number').value), table = document.getElementsByClassName('wptb-preview-table')[0];\r\n for (var i = 0; i < columnCount; i++) {\r\n if (parentRow.getElementsByTagName('td')[i] === td) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n for (var i = 0; i < rowCount; i++) {\r\n var classToAdd = i == 0 ? 'wptb-highlighted-column-first' : i == rowCount - 1 ? 'wptb-highlighted-column-last' : 'wptb-highlighted-column-inner';\r\n var tr = table.getElementsByTagName('tr')[i];\r\n if (tr.getElementsByTagName('td')[index] !== td) {\r\n tr.getElementsByTagName('td')[index].classList.add(classToAdd);\r\n }\r\n }\r\n }\r\n \r\n if( ! DOMElement ) {\r\n DOMElement = document.createElement(\"td\");\r\n\r\n DOMElement.style.padding = jQuery('#wptb-table-padding-number').val() + 'px';\r\n\r\n var innerBorderWidth = jQuery('#wptb-table-inner-border-number').val();\r\n\r\n if (innerBorderWidth != '' && parseInt(innerBorderWidth) != 0) {\r\n DOMElement.style.border = innerBorderWidth + 'px solid ' + jQuery('#wptb-table-border-color').val();\r\n } \r\n\r\n DOMElement.classList.add('wptb-droppable', 'wptb-cell');\r\n }\r\n\r\n DOMElement.draggable = false;\r\n if ( callback ) {\r\n DOMElement.onclick = callback;\r\n }\r\n \r\n WPTB_innerElementSet( DOMElement );\r\n \r\n let wptbPhElement = DOMElement.getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( wptbPhElement.length > 0 ) {\r\n for( let i = 0; i < wptbPhElement.length; i++ ) {\r\n\r\n let wptbSpaceBetween = DOMElement.getElementsByClassName( 'wptb-space-between' );\r\n\r\n if ( wptbSpaceBetween.length > 0 ) {\r\n for( let j = 0; j < wptbSpaceBetween.length; j++ ) {\r\n WPTB_Space( wptbSpaceBetween[j] );\r\n }\r\n }\r\n \r\n wptbPhElement[i].getDOMElement = function() {\r\n return wptbPhElement[i];\r\n }\r\n \r\n WPTB_innerElementSet( wptbPhElement[i] );\r\n \r\n let wptbElementTypeClass = wptbPhElement[i].className.match( /wptb-element-((.+-)\\d+)/i );\r\n if( wptbElementTypeClass && Array.isArray( wptbElementTypeClass ) ) {\r\n let wptbTypeElementArr = wptbElementTypeClass[1].split( '-' );\r\n wptbPhElement[i].kind = wptbTypeElementArr[0];\r\n applyGenericItemSettings( wptbPhElement[i], wptbElementTypeClass[1] );\r\n if ( wptbPhElement[i].kind == 'list' ) {\r\n let wptbListItems = wptbPhElement[i].getElementsByTagName( 'li' );\r\n if( wptbListItems.length > 0 ) {\r\n for ( let i = 0; i < wptbListItems.length; i++ ) {\r\n WPTB_ListItem( undefined, wptbListItems[i] );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n\r\n this.setCoords = function (y, x) {\r\n var el = this.getDOMElement();\r\n el.dataset.yIndex = y;\r\n el.dataset.xIndex = x;\r\n };\r\n\r\n this.getCoords = function () {\r\n var coords,\r\n el = this.getDOMElement();\r\n coords.x = el.dataset.xIndex;\r\n coords.y = el.dataset.yIndex;\r\n return coords;\r\n };\r\n\r\n this.appendElement = function (node) {\r\n getDOMElement().appendChild(node);\r\n };\r\n \r\n DOMElement.getCellDimensions = function() {\r\n let tdStyleObj = window.getComputedStyle( this, null );\r\n \r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n \r\n let tdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n \r\n let tdPaddingTop = tdStyleObj.getPropertyValue( 'padding-top' );\r\n let tdPaddingBottom = tdStyleObj.getPropertyValue( 'padding-bottom' );\r\n \r\n let tdBorderTopWidth = tdStyleObj.getPropertyValue( 'border-top-width' );\r\n let tdBorderBottomWidth = tdStyleObj.getPropertyValue( 'border-bottom-width' );\r\n \r\n let width = parseFloat( this.offsetWidth, 10 ) - \r\n parseFloat( tdPaddingLeft, 10 ) - \r\n parseFloat( tdPaddingRight, 10 ) -\r\n parseFloat( tdBorderLeftWidth, 10 ) -\r\n parseFloat( tdBorderRightWidth, 10 );\r\n \r\n let height = parseFloat( this.offsetHeight, 10 ) - \r\n parseFloat( tdPaddingTop, 10 ) - \r\n parseFloat( tdPaddingBottom, 10 ) -\r\n parseFloat( tdBorderTopWidth, 10 ) -\r\n parseFloat( tdBorderBottomWidth, 10 );\r\n \r\n return {\r\n width: width, \r\n height: height\r\n };\r\n }\r\n\r\n return this;\r\n};","var WPTB_DropHandle = function (thisElem, e) {\r\n \r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n \r\n let wptbDropHandle,\r\n wptbDropBorderMarker;\r\n if ( document.getElementsByClassName( 'wptb-drop-handle' ).length == 0 ) {\r\n wptbDropHandle = document.createElement( 'div' );\r\n wptbDropHandle.classList.add( 'wptb-drop-handle' );\r\n \r\n wptbDropBorderMarker = document.createElement( 'div' );\r\n wptbDropBorderMarker.classList.add( 'wptb-drop-border-marker' );\r\n \r\n let wptbDropBorderMarkerTop = document.createElement( 'div' ),\r\n wptbDropBorderMarkerRight = document.createElement( 'div' ),\r\n wptbDropBorderMarkerBottom = document.createElement( 'div' ),\r\n wptbDropBorderMarkerLeft = document.createElement( 'div' );\r\n \r\n wptbDropBorderMarkerTop.classList.add( 'wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerRight.classList.add( 'wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerBottom.classList.add( 'wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerLeft.classList.add( 'wptb-drop-border-marker-left' );\r\n \r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerTop );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerRight );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerBottom );\r\n wptbDropBorderMarker.appendChild( wptbDropBorderMarkerLeft );\r\n \r\n let body = document.getElementsByTagName( 'body' );\r\n if ( body.length > 0 ) {\r\n body[0].appendChild( wptbDropHandle );\r\n body[0].appendChild( wptbDropBorderMarker );\r\n }\r\n \r\n wptbDropHandle.ondragenter = function () {\r\n\r\n }\r\n\r\n wptbDropHandle.ondragover = function (e) {\r\n e.preventDefault();\r\n }\r\n\r\n wptbDropHandle.ondragleave = function () {\r\n\r\n }\r\n wptbDropHandle.ondrop = function (e) {\r\n e.preventDefault();\r\n let element;\r\n \r\n if ( e.dataTransfer.getData('wptbElement') ) {\r\n element = newElementProxy( e.dataTransfer.getData('wptbElement') );\r\n element = element.getDOMElement();\r\n } else {\r\n element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];\r\n element.classList.remove( 'wptb-moving-mode' );\r\n element.classList.remove( 'wptb-moving-into-same-elem' );\r\n }\r\n \r\n let td;\r\n if( wptbDropHandle.dataset.text == 'Drop Here' ) {\r\n thisElem = wptbDropHandle.getDOMParentElement();\r\n if ( thisElem.nodeName.toLowerCase() == 'td' ) {\r\n td = wptbDropHandle.getDOMParentElement();\r\n td.appendChild( element );\r\n }\r\n } else {\r\n let innerElement = wptbDropHandle.getDOMParentElement();\r\n td = innerElement.parentNode;\r\n \r\n if( wptbDropHandle.dataset.text == 'Above Element' ) {\r\n td.insertBefore( element, innerElement );\r\n } else if( wptbDropHandle.dataset.text == 'Below Element' ) {\r\n let innerElementNext = innerElement.nextSibling;\r\n td.insertBefore( element, innerElementNext );\r\n }\r\n }\r\n \r\n let thisRow = td.parentNode\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let table = WPTB_Helper.findAncestor( thisRow, 'wptb-preview-table' );\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n \r\n WPTB_innerElementSet(element);\r\n \r\n if( ! element.classList.contains( 'wptb-image-container' ) ) {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n let wptbContainer = document.querySelector( '.wptb-container' );\r\n wptbContainer.onscroll = function() {\r\n wptbDropHandle.style.display = 'none';\r\n wptbDropBorderMarker.style.display = 'none';\r\n }\r\n } else {\r\n wptbDropHandle = document.getElementsByClassName( 'wptb-drop-handle' )[0];\r\n wptbDropBorderMarker = document.getElementsByClassName( 'wptb-drop-border-marker' )[0];\r\n }\r\n if( thisElem && thisElem.nodeName.toLowerCase() == 'td' && \r\n thisElem.getElementsByClassName( 'wptb-ph-element' ).length != 0 ) {\r\n return;\r\n }\r\n \r\n let thisRow;\r\n if ( thisElem.localName == 'td' ) {\r\n thisRow = thisElem.parentNode;\r\n } else if ( thisElem.localName == 'div' && thisElem.classList.contains( 'wptb-ph-element' ) ) {\r\n thisRow = thisElem.parentNode.parentNode;\r\n }\r\n if( thisRow.classList.contains( 'wptb-table-head' ) ) {\r\n let indics = e.dataTransfer.types;\r\n let notDragEnter = false;\r\n for ( let i = 0; i < indics.length; i++ ) {\r\n let infArr = indics[i].match( /wptbelindic-([a-z]+)/i );\r\n if ( infArr && infArr[1] != 'text' ) {\r\n notDragEnter = true;\r\n break;\r\n }\r\n }\r\n if( notDragEnter ) {\r\n return;\r\n }\r\n }\r\n \r\n wptbDropHandle.style.width = thisElem.offsetWidth + 'px';\r\n let height = thisElem.offsetHeight,\r\n coordinatesElement = thisElem.getBoundingClientRect(),\r\n left = parseFloat( coordinatesElement.left ),\r\n top;\r\n wptbDropHandle.style.left = left + 'px';\r\n \r\n if( e.dataTransfer.types.indexOf( 'wptb-moving-mode' ) != -1 ) {\r\n let elementDrag = document.getElementsByClassName( 'wptb-moving-mode' )[0];\r\n if( thisElem == elementDrag ) {\r\n wptbDropHandle.classList.add('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.add('wptb-moving-into-same-elem');\r\n } else {\r\n wptbDropHandle.classList.remove('wptb-moving-into-same-elem');\r\n wptbDropBorderMarker.classList.remove('wptb-moving-into-same-elem');\r\n }\r\n }\r\n \r\n wptbDropHandle.getDOMParentElement = function() {\r\n return thisElem;\r\n }\r\n \r\n wptbDropHandle.style.display = 'block';\r\n wptbDropBorderMarker.style.display = 'block';\r\n if( thisElem.nodeName.toLowerCase() != 'td' ) {\r\n let y = e.offsetY==undefined?e.layerY:e.offsetY;\r\n top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );\r\n wptbDropHandle.dataset.text = 'Abowe Element';\r\n if ( y > height/2 ) {\r\n top = parseFloat( coordinatesElement.top ) + height - 1;\r\n wptbDropHandle.dataset.text = 'Below Element';\r\n }\r\n } else {\r\n wptbDropHandle.dataset.text = 'Drop Here';\r\n top = parseFloat( coordinatesElement.top ) + height/2 - 5;\r\n }\r\n wptbDropHandle.style.top = top + 'px';\r\n\r\n wptbDropBorderMarker.style.top = coordinatesElement.top + 'px';\r\n wptbDropBorderMarker.style.left = coordinatesElement.left + 'px';\r\n\r\n wptbDropBorderMarkerTop = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-top' );\r\n wptbDropBorderMarkerTop.style.width = ( parseFloat( thisElem.offsetWidth ) - parseFloat( 1 ) ) + 'px';\r\n\r\n wptbDropBorderMarkerRight = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-right' );\r\n wptbDropBorderMarkerRight.style.height = ( parseFloat( coordinatesElement.bottom ) - parseFloat( coordinatesElement.top ) - 1 ) + 'px';\r\n wptbDropBorderMarkerRight.style.left = wptbDropBorderMarkerTop.style.width;\r\n\r\n wptbDropBorderMarkerBottom = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-bottom' );\r\n wptbDropBorderMarkerBottom.style.width = wptbDropBorderMarkerTop.style.width;\r\n wptbDropBorderMarkerBottom.style.top = wptbDropBorderMarkerRight.style.height;\r\n\r\n wptbDropBorderMarkerLeft = wptbDropBorderMarker.querySelector( '.wptb-drop-border-marker-left' );\r\n wptbDropBorderMarkerLeft.style.height = wptbDropBorderMarkerRight.style.height;\r\n}","var ElementCounters = function () {\r\n\r\n\tvar priv = [];\r\n\tpriv['text'] = 0;\r\n\tpriv['image'] = 0;\r\n\tpriv['list'] = 0;\r\n\tpriv['button'] = 0;\r\n\r\n\tthis.increment = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tpriv[key]++;\r\n\t}\r\n\r\n\tthis.nextIndex = function (key) {\r\n\t\tif (!(key in priv)) {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\treturn priv[key] + 1;\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};","var WPTB_ElementOptions = function ( element, index, kindIndexProt ) {\r\n\r\n var node = element.getDOMElement(), elemIdClass;\r\n\r\n prop = document.querySelector(\".wptb-\" + element.kind + \"-options-prototype\").cloneNode(true);\r\n prop.classList.remove(\"wptb-\" + element.kind + \"-options-prototype\"); // remove prototype from the class\r\n elemIdClass = 'wptb-options-' + element.kind + \"-\" + index;\r\n\r\n var properties = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < properties.length; i++) {\r\n properties[i].dataset.element = elemIdClass;\r\n }\r\n\r\n prop.classList.add(elemIdClass);\r\n document.getElementById(\"element-options-group\").appendChild(prop);\r\n \r\n if ( kindIndexProt ) {\r\n if ( element.kind == 'button' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt )[0],\r\n wptbButtonWrapper,\r\n wptbButtonA,\r\n wptbButton,\r\n wptbSize;\r\n \r\n if ( affectedEl ) {\r\n wptbSize = affectedEl.className.match(/wptb-size-([a-z]+)/i);\r\n }\r\n \r\n if( wptbSize && Array.isArray( wptbSize ) ) {\r\n var b = prop.getElementsByClassName('wptb-btn-size-btn');\r\n \r\n for ( var i = 0; i < b.length; i++ ) {\r\n b[i].classList.remove( 'selected' );\r\n \r\n if ( b[i].innerHTML == wptbSize[1] ) {\r\n b[i].classList.add( 'selected' );\r\n }\r\n }\r\n }\r\n \r\n if( affectedEl ) {\r\n wptbButtonWrapper = affectedEl.getElementsByClassName( 'wptb-button-wrapper' );\r\n \r\n wptbButtonA = affectedEl.getElementsByTagName( 'a' );\r\n \r\n wptbButton = affectedEl.getElementsByClassName( 'wptb-button' );\r\n }\r\n \r\n if ( wptbButtonWrapper ) {\r\n let buttonAlignment = wptbButtonWrapper[0].style.justifyContent,\r\n buttonAlignmentSelect = prop.querySelector( 'select[data-type=\"button-alignment\"]' ),\r\n selectOption = buttonAlignmentSelect.getElementsByTagName( 'option' ),\r\n selectOptionVal;\r\n \r\n if ( buttonAlignment == 'flex-start' ) {\r\n selectOptionVal = 'left';\r\n } else if ( buttonAlignment == 'center' || ! buttonAlignment ) {\r\n selectOptionVal = 'center';\r\n } else if ( buttonAlignment == 'flex-end' ) {\r\n selectOptionVal = 'right';\r\n }\r\n \r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == selectOptionVal ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n }\r\n \r\n if ( wptbButtonA.length > 0 ) {\r\n let buttonHref = wptbButtonA[0].getAttribute( 'href' ), \r\n buttonLinkTarget = wptbButtonA[0].getAttribute( 'target' ),\r\n buttonId = wptbButtonA[0].getAttribute( 'id' ),\r\n \r\n \r\n buttonHrefInput = prop.querySelector( 'input[data-type=\"button-link\"]' ),\r\n buttonLinkTargetInput = prop.querySelector( 'input[data-type=\"button-link-target\"]' ),\r\n buttonLinkTargetInputId = buttonLinkTargetInput.getAttribute( 'id' ),\r\n buttonLinkTargetInputLabel = buttonLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0],\r\n \r\n buttotIdInput = prop.querySelector( 'input[data-type=\"button-id\"]' );\r\n\r\n buttonLinkTargetInputId = buttonLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n buttonLinkTargetInput.setAttribute( 'id', buttonLinkTargetInputId );\r\n buttonLinkTargetInputLabel.setAttribute( 'for', buttonLinkTargetInputId );\r\n\r\n buttonHrefInput.value = buttonHref;\r\n\r\n if( buttonLinkTarget && buttonLinkTarget == '_blank') {\r\n buttonLinkTargetInput.checked = true;\r\n }\r\n \r\n buttotIdInput.value = buttonId;\r\n }\r\n \r\n if( wptbButton ) {\r\n let buttonTextColor = wptbButton[0].style.color,\r\n buttonColor = wptbButton[0].style.backgroundColor,\r\n buttonTextColorInput = prop.querySelector( 'input[data-type=\"button-text-color\"]' ),\r\n buttonBackgroundColorInput = prop.querySelector( 'input[data-type=\"button-color\"]' );\r\n \r\n \r\n buttonTextColorInput.value = WPTB_Helper.rgbToHex( buttonTextColor );\r\n \r\n buttonBackgroundColorInput.value = WPTB_Helper.rgbToHex( buttonColor );\r\n \r\n }\r\n } else if ( element.kind == 'image' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n \r\n let wptbImageWrapper = affectedEl[0].getElementsByClassName( 'wptb-image-wrapper' );\r\n if( wptbImageWrapper.length > 0 ) {\r\n wptbImageWrapper = wptbImageWrapper[0];\r\n \r\n // set select according to the alignment of the image\r\n let imgAlign = wptbImageWrapper.style.textAlign,\r\n imageAlignmentSelect = prop.querySelector( 'select[data-type=\"image-alignment\"]' ),\r\n selectOption = imageAlignmentSelect.getElementsByTagName( 'option' );\r\n\r\n for ( let i = 0; i < selectOption.length; i++ ) {\r\n if ( selectOption[i].value == imgAlign ) {\r\n selectOption[i].selected = true;\r\n }\r\n }\r\n \r\n \r\n let elementsA = wptbImageWrapper.getElementsByTagName( 'a' );\r\n if ( elementsA.length > 0 ) {\r\n let a = elementsA[0];\r\n\r\n if ( a ) {\r\n a.onclick = function( e ) {\r\n e.preventDefault();\r\n }\r\n\r\n // set text link for input field of setting panel\r\n let imageLinkHref = a.getAttribute( 'href' ),\r\n inputImageLink = prop.querySelector( 'input[data-type=\"image-link\"]' );\r\n if ( imageLinkHref ) {\r\n inputImageLink.value = imageLinkHref;\r\n }\r\n\r\n // set checkbox for target of link \r\n let imageLinkTarget = a.getAttribute( 'target' ),\r\n imageLinkTargetInput = prop.querySelector( 'input[data-type=\"image-link-target\"]' ),\r\n imageLinkTargetInputId = imageLinkTargetInput.getAttribute( 'id' ),\r\n imageLinkTargetInputLabel = imageLinkTargetInput.parentNode.getElementsByTagName( 'label' )[0];\r\n\r\n imageLinkTargetInputId = imageLinkTargetInputId + '-' + kindIndexProt.split( '-' )[1];\r\n\r\n imageLinkTargetInput.setAttribute( 'id', imageLinkTargetInputId );\r\n imageLinkTargetInputLabel.setAttribute( 'for', imageLinkTargetInputId );\r\n\r\n if ( imageLinkTarget && imageLinkTarget == '_blank' ) {\r\n imageLinkTargetInput.checked = true;\r\n }\r\n\r\n // set value for input fields of image size\r\n let imgWidth = a.style.width;\r\n if ( imgWidth ) {\r\n let imageWidthInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"image-size\"]' ),\r\n imageWidthInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"image-size\"]' );\r\n\r\n imageWidthInputRange.value = parseInt( imgWidth );\r\n imageWidthInputNumber.value = parseInt( imgWidth );\r\n }\r\n\r\n let img = a.getElementsByTagName( 'img' );\r\n if ( img.length > 0 ) {\r\n // set value for input field of alternative text image\r\n let imgAlternativeText = img[0].getAttribute('alt'),\r\n imageAlternativeTextInput = prop.querySelector( 'input[type=\"text\"][data-type=\"alternative-text\"]' );\r\n\r\n imageAlternativeTextInput.value = imgAlternativeText;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n } else if ( element.kind == 'text' ) {\r\n let affectedEl = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( affectedEl.length > 0 ) {\r\n let elementFontSize = affectedEl[0].style.fontSize,\r\n elementTextColor = affectedEl[0].style.color;\r\n let textFontSizeInputRange = prop.querySelector( 'input[type=\"range\"][data-type=\"font-size\"]' ),\r\n textFontSizeInputNumber = prop.querySelector( 'input[type=\"number\"][data-type=\"font-size\"]' ),\r\n textColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"color\"]' );\r\n\r\n textFontSizeInputRange.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\r\n textFontSizeInputNumber.value = parseInt( elementFontSize ) ? parseInt( elementFontSize ) : 10;\r\n textColorInput.value = WPTB_Helper.rgbToHex( elementTextColor );\r\n }\r\n } else if ( element.kind == 'list' ) {\r\n let elementList = document.getElementsByClassName( 'wptb-element-' + kindIndexProt );\r\n if ( elementList.length > 0 ) {\r\n let elementListColor = elementList[0].querySelector( 'p' ).style.color;\r\n let listColorInput = prop.querySelector( 'input[type=\"text\"][data-type=\"list-text-color\"]' );\r\n listColorInput.value = WPTB_Helper.rgbToHex( elementListColor );\r\n \r\n let elementListItem = elementList[0].querySelectorAll( 'li' );\r\n if ( elementListItem.length > 0 ) {\r\n let listItemP = elementListItem[0].querySelector( 'p' );\r\n let listItemPClasses = listItemP.classList;\r\n //listItemPClasses = [...listItemPClasses];\r\n if ( listItemPClasses.length > 0 ) {\r\n let elementListClassSelect = prop.querySelector( 'select[data-type=\"list-class\"]' );\r\n if ( elementListClassSelect ) {\r\n elementListClassSelect.value = 'unordered';\r\n \r\n let listIconSelectLabel = elementListClassSelect.parentNode.nextSibling;\r\n for ( let i = 0; i < 10; i++ ) {\r\n if ( listIconSelectLabel.nodeType == '1' ) {\r\n break;\r\n } else {\r\n listIconSelectLabel = listIconSelectLabel.nextSibling;\r\n }\r\n }\r\n if ( listIconSelectLabel ) {\r\n let listIconSelectLabelId = listIconSelectLabel.getAttribute( 'id' );\r\n listIconSelectLabel.setAttribute( 'id', listIconSelectLabelId + '-' + kindIndexProt );\r\n listIconSelectLabel.style.display = 'flex';\r\n }\r\n \r\n let elementListStyleTypeSelect = prop.querySelector( 'select[data-type=\"list-style-type\"]' );\r\n if ( elementListStyleTypeSelect ) {\r\n elementListStyleTypeSelect.parentNode.style.display = 'flex';\r\n \r\n if( listItemPClasses.contains( 'wptb-list-style-type-disc' ) ) {\r\n elementListStyleTypeSelect.value = 'disc';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-circle' ) ) {\r\n elementListStyleTypeSelect.value = 'circle';\r\n } else if( listItemPClasses.contains( 'wptb-list-style-type-square' ) ) {\r\n elementListStyleTypeSelect.value = 'square';\r\n } else if ( listItemPClasses.contains( 'wptb-list-style-type-none' ) ) {\r\n elementListStyleTypeSelect.value = 'none';\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListItemContent = elementList[0].getElementsByClassName( 'wptb-list-item-content' );\r\n if ( elementListItemContent.length > 0 ) {\r\n let listItemPTextAlignArr = [];\r\n for ( let i = 0; i < elementListItemContent.length; i++ ) {\r\n let p = elementListItemContent[i].querySelector( 'p' );\r\n if ( p ) {\r\n if ( p.style.textAlign ) {\r\n listItemPTextAlignArr.push( p.style.textAlign );\r\n } else {\r\n listItemPTextAlignArr.push( 'left' );\r\n }\r\n }\r\n \r\n }\r\n \r\n let listItemPTextAlignLeftCount = 0,\r\n listItemPTextAlignCenterCount = 0,\r\n listItemPTextAlignRightCount = 0;\r\n \r\n if ( listItemPTextAlignArr.length > 0 ) {\r\n for ( let i = 0; i < listItemPTextAlignArr.length; i++ ) {\r\n if ( listItemPTextAlignArr[i] ) {\r\n if ( listItemPTextAlignArr[i] == 'left' ) {\r\n listItemPTextAlignLeftCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'center' ) {\r\n listItemPTextAlignCenterCount++;\r\n } else if ( listItemPTextAlignArr[i] == 'right' ) {\r\n listItemPTextAlignRightCount++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let elementListAlignmentSelect = prop.querySelector( 'select[data-type=\"list-alignment\"]' ),\r\n maxListItemTAlLeftC = Math.max( listItemPTextAlignLeftCount, listItemPTextAlignCenterCount, listItemPTextAlignRightCount );\r\n \r\n if ( listItemPTextAlignLeftCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'left';\r\n } else if ( listItemPTextAlignCenterCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'center';\r\n } else if ( listItemPTextAlignRightCount == maxListItemTAlLeftC ) {\r\n elementListAlignmentSelect.value = 'right';\r\n }\r\n }\r\n } \r\n }\r\n }\r\n\r\n node.onclick = function () {\r\n var infArr = this.className.match(/wptb-element-((.+-)\\d+)/i),\r\n optionsClass = '.wptb-' + infArr[2] + 'options' +\r\n '.wptb-options-' + infArr[1];\r\n\r\n document.getElementsByClassName('wptb-elements-container')[0].style.display = 'none';\r\n document.getElementsByClassName('wptb-settings-section')[0].style.display = 'none';\r\n document.getElementById(\"element-options-group\").style.display = 'block';\r\n\r\n var children = document.getElementById(\"element-options-group\").childNodes;\r\n for (var i = 0; i < children.length; i++) {\r\n if (children[i].style)\r\n children[i].style.display = 'none';\r\n }\r\n\r\n document.querySelector(optionsClass).style.display = 'block';\r\n\r\n //var listStyleType, textAlign;\r\n\r\n// switch (element.kind) {\r\n\r\n// case 'text':\r\n// jQuery(prop).find('[data-type=color]').wpColorPicker({ defaultColor: node.style.color });\r\n// prop.querySelector('[type=number][data-type=font-size]').value\r\n// = prop.querySelector('[type=range][data-type=font-size]').value\r\n// = node.style.fontSize.substring(0, node.style.fontSize.length - 2);\r\n// break;\r\n// case 'list':\r\n// textAlign = node.querySelector('li p').style.textAlign;\r\n// listStyleType = node.querySelector('li').style.listStyleType;\r\n// if ( prop.querySelector( 'select[data-type=list-class]' ) ) {\r\n// console.log(textAlign);\r\n// console.log(listStyleType);\r\n// console.log(listStyleType);\r\n// console.log(prop);\r\n// prop.querySelector('select[data-type=list-class]').selectedIndex = ( listStyleType == 'decimal' ? 0 : 1 );\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-style-type]') ) {\r\n// prop.querySelector('select[data-type=list-style-type]').selectedIndex = (listStyleType == 'circle' ? 0 : (listStyleType == 'square' ? 1 : 2));\r\n// }\r\n// if ( prop.querySelector('select[data-type=list-alignment]') ) {\r\n// prop.querySelector('select[data-type=list-alignment]').selectedIndex = (textAlign == 'left' ? 0 : (textAlign == 'center' ? 1 : 2));\r\n// }\r\n// break;\r\n// case 'image':\r\n// break;\r\n// case 'button':\r\n// jQuery(prop).find('[data-type=button-color]').wpColorPicker({ defaultColor: node.style.backgroundColor });\r\n// break;\r\n//\r\n// }\r\n };\r\n\r\n if (element.kind == 'button') {\r\n //We must add this special kind of property, since it is triggered with click event\r\n var buttons = prop.getElementsByClassName('wptb-btn-size-btn');\r\n\r\n for (var i = 0; i < buttons.length; i++) {\r\n buttons[i].onclick = function () {\r\n var size = this.innerHTML,\r\n n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0];\r\n affectedEl.classList.remove('wptb-size-S');\r\n affectedEl.classList.remove('wptb-size-M');\r\n affectedEl.classList.remove('wptb-size-L');\r\n affectedEl.classList.remove('wptb-size-XL');\r\n affectedEl.classList.add('wptb-size-' + size);\r\n var b = this.parentNode.getElementsByClassName('wptb-btn-size-btn');\r\n for (var i = 0; i < b.length; i++) {\r\n b[i].classList.remove('selected');\r\n }\r\n this.classList.add('selected');\r\n \r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n\r\n var optionControls = prop.getElementsByClassName('wptb-element-property');\r\n\r\n for (var i = 0; i < optionControls.length; i++) {\r\n if (optionControls[i].classList.contains('wptb-color-picker')) {\r\n jQuery(optionControls[i]).wpColorPicker({\r\n change: function (event, ui) {\r\n var parent = event.target, classe, type, ps, number;\r\n classe = parent.dataset.element.match(/wptb-options-(.+)-(\\d+)/i);\r\n type = classe[1];\r\n number = classe[2];\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + number)[0];\r\n if ( type == 'button' ) {\r\n if (parent.dataset.type == 'button-text-color') {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.color = ui.color.toString();\r\n } else {\r\n affectedEl.getElementsByClassName('wptb-button')[0].style.backgroundColor = ui.color.toString();\r\n }\r\n } else if( type == 'list' ) {\r\n let ps = affectedEl.querySelectorAll( 'p' );\r\n if( ps.length > 0 ) {\r\n for ( let i = 0; i < ps.length; i++ ) {\r\n ps[i].style.color = ui.color.toString();\r\n }\r\n }\r\n } else {\r\n affectedEl.style.color = ui.color.toString();\r\n }\r\n \r\n //console.log(event);\r\n WPTB_Helper.wpColorPickerCheckChangeForTableStateSaving( event );\r\n }\r\n });\r\n }\r\n\r\n if ( optionControls[i].dataset.type === 'font-size' ) {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-number')[0].onchange( event );\r\n }\r\n }\r\n\r\n if (optionControls[i].dataset.type === 'image-size') {\r\n var slider = optionControls[i].parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0];\r\n slider.oninput = function () {\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].value = this.value;\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-width-number')[0].onchange( event );\r\n }\r\n }\r\n\r\n optionControls[i].onchange = function ( event ) {\r\n var n_Class = this.dataset.element,\r\n infArr = n_Class.match(/wptb-options-(.+)-(\\d+)/i),\r\n type = infArr[1],\r\n num = infArr[2],\r\n affectedEl = document.getElementsByClassName('wptb-element-' + type + '-' + num)[0],\r\n val = this.value;\r\n\r\n switch ( this.dataset.type ) {\r\n case 'src':\r\n var img = affectedEl.getElementsByTagName(\"img\")[0];\r\n img.src = this.value;\r\n break;\r\n case 'alternative-text':\r\n var img = affectedEl.getElementsByTagName('img')[0];\r\n img.alt = this.value;\r\n break;\r\n case 'image-link':\r\n affectedEl.getElementsByTagName('a')[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n break;\r\n case 'image-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'image-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute('rel');\r\n }\r\n break;\r\n case 'image-size':\r\n affectedEl.getElementsByTagName('a')[0].style.width = this.value + '%';\r\n affectedEl.getElementsByTagName('a')[0].style.height = 'auto';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-image-size-slider')[0].value = this.value;\r\n break;\r\n case 'image-alignment':\r\n affectedEl.getElementsByClassName( 'wptb-image-wrapper' )[0].style.textAlign = this.value;\r\n break;\r\n case 'font-size':\r\n affectedEl.style.fontSize = val + 'px';\r\n this.parentNode.parentNode.getElementsByClassName('wptb-text-font-size-slider')[0].value = this.value;\r\n break;\r\n case 'button-alignment':\r\n var jc = '';\r\n if (this.value == 'left') {\r\n jc = 'start';\r\n } else if (this.value == 'right') {\r\n jc = 'flex-end';\r\n } else {\r\n jc = 'center';\r\n }\r\n affectedEl.getElementsByClassName('wptb-button-wrapper')[0].style.justifyContent = jc;\r\n break;\r\n case 'button-link':\r\n if ( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].href = WPTB_Helper.linkHttpCheckChange( this.value );\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'href' );\r\n }\r\n break;\r\n case 'button-link-target':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].target = '_blank';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].target = '_self';\r\n }\r\n break;\r\n case 'button-link-nofollow':\r\n if (this.checked == true) {\r\n affectedEl.getElementsByTagName('a')[0].rel = 'nofollow';\r\n } else {\r\n affectedEl.getElementsByTagName('a')[0].removeAttribute( 'rel' );\r\n }\r\n break;\r\n case 'button-id':\r\n if( this.value ) {\r\n affectedEl.getElementsByTagName( 'a' )[0].id = this.value;\r\n } else {\r\n affectedEl.getElementsByTagName( 'a' )[0].removeAttribute( 'id' );\r\n }\r\n case 'button-color':\r\n break;\r\n case 'list-alignment':\r\n let listItems = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItems.length; i++) {\r\n let p = listItems[i].querySelector( 'p' );\r\n if ( p ) {\r\n p.style.textAlign = this.value;\r\n }\r\n }\r\n break;\r\n case 'list-class':\r\n let parentNode = event.target\r\n .parentNode\r\n .parentNode\r\n .querySelector('[data-type=list-style-type]')\r\n .parentNode,\r\n parentNodeSettingItem = parentNode.parentNode;\r\n if (val == 'unordered') {\r\n parentNode.style.display = 'flex';\r\n \r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'flex';\r\n let listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-disc' );\r\n }\r\n parentNodeSettingItem.querySelector('[data-type=list-style-type]').value = 'disc';\r\n } else {\r\n parentNode.style.display = 'none';\r\n parentNodeSettingItem.querySelector( '.wptb-list-icon-select-label' ).style.display = 'none';\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n }\r\n }\r\n break;\r\n case 'list-style-type':\r\n var listItem = affectedEl.querySelectorAll('li');\r\n for (var i = 0; i < listItem.length; i++) {\r\n let p = listItem[i].querySelector( 'p' );\r\n p.removeAttribute ( 'class' );\r\n p.classList.add( 'wptb-list-style-type-' + val.toLowerCase() );\r\n }\r\n break;\r\n }\r\n \r\n \r\n if( event.target.classList.contains( 'wptb-text-font-size-slider' ) || event.target.classList.contains( 'wptb-image-size-slider' ) ) {\r\n event.target.onmouseup = function() {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n } else {\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n }\r\n }\r\n};","var WPTB_Helper = {\r\n hexToRgb: function( hex ) {\r\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec( hex );\r\n return result ? 'rgb(' + parseInt( result[1], 16 ) + ',' + parseInt( result[2], 16 ) + ',' + parseInt( result[3], 16 ) + ')' : null;\r\n },\r\n rgbToHex: function ( rgb ) {\r\n var rgb = rgb.match( /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i );\r\n\r\n return ( rgb && rgb.length === 4 ) ? \"#\" +\r\n ( \"0\" + parseInt( rgb[1],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[2],10 ).toString( 16 )).slice( -2 ) +\r\n ( \"0\" + parseInt( rgb[3],10 ).toString( 16 )).slice( -2 ) : '';\r\n },\r\n getDragImageCustom: function ( type ) {\r\n let hostName = location.protocol + '//' + location.hostname;\r\n let img = document.createElement( 'img' );\r\n img.src = hostName + '/wp-content/plugins/wp-table-builder/inc/admin/views/builder/icons/' + type + '.png';\r\n return img;\r\n },\r\n dragImagesArr: function() {\r\n return {\r\n text: WPTB_Helper.getDragImageCustom( 'text' ),\r\n image: WPTB_Helper.getDragImageCustom( 'image' ),\r\n button: WPTB_Helper.getDragImageCustom( 'button' ),\r\n list: WPTB_Helper.getDragImageCustom( 'list' )\r\n };\r\n },\r\n listItemsRecalculateIndex: function( ulElem ) {\r\n let par = ulElem.querySelectorAll( 'p' );\r\n if ( par.length > 0 ) {\r\n for ( let i = 0; i < par.length; i++ ) {\r\n par[i].dataset.listStyleTypeIndex = Number( i ) + 1 + '.';\r\n }\r\n }\r\n },\r\n listItemsTinyMceInit: function( listItem ) {\r\n tinyMCE.init({\r\n target: listItem,\r\n inline: true,\r\n plugins: \"link, paste\",\r\n dialog_type: \"modal\",\r\n theme: 'modern',\r\n menubar: false,\r\n fixed_toolbar_container: '#wpcd_fixed_toolbar',\r\n paste_as_text: true,\r\n toolbar: 'bold italic strikethrough link unlink | alignleft aligncenter alignright alignjustify',\r\n setup: function(ed) {\r\n ed.on('keydown', function(e) {\r\n let article = e.target.parentNode;\r\n if ( e.keyCode == 13 ) {\r\n e.preventDefault();\r\n let text = e.target.innerHTML;\r\n let duplicate = new WPTB_ListItem( text, article, true );\r\n \r\n article.parentNode.insertBefore( duplicate.getDOMElement(), article );\r\n WPTB_Helper.listItemsTinyMceInit( duplicate.getDOMElement().firstChild );\r\n e.target.querySelector( 'p' ).innerText = 'New List Item';\r\n //tinyMCE.execCommand('mceInsertContent', false, 'New List Item');\r\n WPTB_Helper.listItemsRecalculateIndex( article.parentNode );\r\n \r\n return;\r\n \r\n } else if ( e.keyCode == '8' || e.keyCode == '46' ) {\r\n let p = e.target.querySelector( 'p' );\r\n let pText = p.innerHTML.replace(/<[^>]+>/g, '');\r\n pText = pText.replace( /\\s+/g, ' ' ).trim();\r\n pText = pText.replace( / /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 document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-popup-window-close-icon' )[0].onclick = function () {\r\n shortcodePopupWindow.classList.remove( 'wptb-popup-show' );\r\n }\r\n \r\n document.getElementsByClassName( 'wptb-preview-btn' )[0].onclick = function ( e ) {\r\n if( this.classList.contains( 'wptb-button-disable' ) ) {\r\n e.preventDefault();\r\n }\r\n }\r\n\r\n document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function () {\r\n let bar = document.querySelector( '.wptb-edit-bar' );\r\n if ( bar && bar.classList.contains( 'visible' ) ) {\r\n let table = document.getElementsByClassName( 'wptb-preview-table' )[0];\r\n table.toggleTableEditMode();\r\n }\r\n\r\n let http = new XMLHttpRequest(),\r\n url = ( wptb_admin_object ? wptb_admin_object.ajaxurl : ajaxurl ) + \"?action=save_table\",\r\n t = document.getElementById( 'wptb-setup-name' ).value.trim(),\r\n messagingArea,\r\n code = document.getElementsByClassName( 'wptb-preview-table' );\r\n if( code.length > 0 ) {\r\n code = WPTB_Stringifier( code[0] );\r\n code = code.outerHTML;\r\n } else { \r\n code = '';\r\n }\r\n \r\n if ( t === '' || code === '' ) {\r\n let messagingAreaText = '';\r\n if( t === '' ) messagingAreaText += 'You must assign a name to the table before saving it.</br>';\r\n if( code === '' ) messagingAreaText += 'Table wasn\\'t created';\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Error: ' + messagingAreaText + '</div>';\r\n messagingArea.classList.add( 'wptb-warning' );\r\n setTimeout(function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n return;\r\n }\r\n\r\n let params = {\r\n title: t,\r\n content: code,\r\n security_code: wptb_admin_object.security_code\r\n };\r\n if (( rs = WPTB_Helper.detectMode() ) || ( rs = document.wptbId )) {\r\n params.id = rs;\r\n }\r\n params = JSON.stringify( params );\r\n\r\n http.open('POST', url, true);\r\n http.setRequestHeader( 'Content-type', 'application/json; charset=utf-8' );\r\n\r\n http.onreadystatechange = function (action) {\r\n if ( this.readyState == 4 && this.status == 200 ) {\r\n var data = JSON.parse( http.responseText );\r\n messagingArea = document.getElementById( 'wptb-messaging-area' );\r\n\r\n if ( data[0] == 'saved' ) {\r\n document.wptbId = data[1];\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully saved.</div>';\r\n document.getElementsByClassName( 'wptb-embed-btn' )[0].classList.remove( 'wptb-button-disable' );\r\n document.getElementById( 'wptb-embed-shortcode' ).value = '[wptb id=' + data[1] + ']';\r\n let wptbPreviewBtn = document.getElementsByClassName( 'wptb-preview-btn' );\r\n if( wptbPreviewBtn.length > 0 ) {\r\n wptbPreviewBtn = wptbPreviewBtn[0];\r\n wptbPreviewBtn.classList.remove( 'wptb-button-disable' );\r\n let wptbPreviewBtnHref = wptbPreviewBtn.dataset.previewHref;\r\n wptbPreviewBtnHref = wptbPreviewBtnHref.replace( 'empty', data[1] );\r\n wptbPreviewBtn.setAttribute( 'href', wptbPreviewBtnHref );\r\n }\r\n \r\n } else if( data[0] == 'edited' ) {\r\n messagingArea.innerHTML = '<div class=\"wptb-success wptb-message\">Table \"' + t + '\" was successfully updated.</div>';\r\n } else {\r\n messagingArea.innerHTML = '<div class=\"wptb-error wptb-message\">Safety problems</div>';\r\n }\r\n messagingArea.classList.add( 'wptb-success' );\r\n setTimeout( function () {\r\n messagingArea.removeChild( messagingArea.firstChild );\r\n }, 4000 );\r\n }\r\n }\r\n http.send( params );\r\n }\r\n};\r\n","var WPTB_Space = function ( elSpaceBetween ) {\r\n\r\n function newElementProxy(el) {\r\n if (el.includes('list')) {\r\n return new WPTB_List();\r\n } else if (el.includes('image')) {\r\n return new WPTB_Image();\r\n } else if (el.includes('text')) {\r\n return new WPTB_Text();\r\n } else if (el.includes('button')) {\r\n return new WPTB_Button();\r\n }\r\n }\r\n let spaceBetween;\r\n if ( ! elSpaceBetween ) {\r\n spaceBetween = document.createElement('div'), spaceBetween.classList.add('wptb-space-between');\r\n } else {\r\n spaceBetween = elSpaceBetween;\r\n }\r\n\r\n spaceBetween.ondragenter = function () {\r\n this.classList.add('visible');\r\n };\r\n spaceBetween.ondragover = function (event) {\r\n event.preventDefault();\r\n };\r\n\r\n spaceBetween.ondragleave = function () {\r\n this.classList.remove('visible');\r\n };\r\n\r\n spaceBetween.ondrop = function (event) {\r\n event.stopPropagation();\r\n\r\n var p = event.target.nextSibling,\r\n td = event.target,\r\n element, t_space, spaceParent;\r\n\r\n while ( !td.classList.contains('wptb-droppable') ) {\r\n td = td.parentNode;\r\n }\r\n\r\n if (event.dataTransfer.getData('wptbElement')) {\r\n element = newElementProxy(event.dataTransfer.getData('wptbElement'));\r\n this.classList.remove('visible');\r\n\r\n if (p == null) {\r\n td.appendChild(element.getDOMElement());\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element.getDOMElement(), p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n } else {\r\n alert(event.dataTransfer.getData('node'));\r\n element = document.getElementsByClassName(event.dataTransfer.getData('node'))[0];\r\n t_space = element.nextSibling;\r\n spaceParent = element.parentNode;\r\n if (t_space != undefined) {\r\n spaceParent.removeChild(t_space);\r\n }\r\n\r\n if (p == null) {\r\n td.appendChild(element);\r\n td.appendChild(new WPTB_Space());\r\n } else {\r\n td.insertBefore(element, p);\r\n td.insertBefore(new WPTB_Space(), p);\r\n }\r\n\r\n }\r\n this.classList.remove('visible');\r\n };\r\n \r\n if ( ! elSpaceBetween ) {\r\n return spaceBetween;\r\n }\r\n};","var WPTB_Stringifier = function ( codeMain ) {\r\n if ( codeMain ) {\r\n let code = codeMain.cloneNode( true );\r\n code.classList.add( 'wptb-table-preview-static-indic' );\r\n code.dataset.tableColumns = codeMain.columns;\r\n code.style.width = null;\r\n code.style.minWidth = null;\r\n code.style.maxWidth = null;\r\n \r\n let tds = code.getElementsByTagName( 'td' );\r\n if ( tds.length > 0 ) {\r\n for ( let i = 0; i < tds.length; i++ ) {\r\n \r\n if ( codeMain.querySelector( 'wptb-table-preview-head' ) ) {\r\n tds[i].removeAttribute( 'data-x-index' );\r\n }\r\n tds[i].removeAttribute( 'data-y-index' );\r\n tds[i].removeAttribute( 'draggable' );\r\n tds[i].classList.remove( 'wptb-droppable' );\r\n let innerElements = tds[i].getElementsByClassName( 'wptb-ph-element' );\r\n \r\n if ( innerElements.length > 0 ) {\r\n for ( let j = 0; j < innerElements.length; j++ ) {\r\n \r\n let mceContentBodys = innerElements[j].querySelectorAll( '.mce-content-body' );\r\n if( mceContentBodys.length > 0 ) {\r\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\r\n mceContentBodys[k].classList.remove( 'mce-content-body' );\r\n }\r\n }\r\n \r\n let dataMceStyle = innerElements[j].querySelectorAll( '[data-mce-style]' );\r\n if ( dataMceStyle.length > 0 ) {\r\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\r\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\r\n }\r\n }\r\n \r\n let contentEditable = innerElements[j].querySelectorAll( '[contenteditable]' );\r\n if ( contentEditable.length > 0 ) {\r\n for ( let k = 0; k < contentEditable.length; k++ ) {\r\n contentEditable[k].removeAttribute( 'contenteditable' );\r\n }\r\n }\r\n \r\n let spellCheck = innerElements[j].querySelectorAll( '[spellcheck]' );\r\n if ( spellCheck.length > 0 ) {\r\n for ( let k = 0; k < spellCheck.length; k++ ) {\r\n spellCheck[k].removeAttribute( 'spellcheck' );\r\n }\r\n }\r\n \r\n let mceIds = innerElements[j].querySelectorAll( '[id^=mce_]' );\r\n if ( mceIds.length > 0 ) {\r\n for ( let k = 0; k < mceIds.length; k++ ) {\r\n mceIds[k].removeAttribute( 'id' );\r\n }\r\n }\r\n \r\n let wptbActions = innerElements[j].querySelectorAll( '.wptb-actions' );\r\n let wptbActionsLength = wptbActions.length;\r\n while ( wptbActionsLength > 0 ) {\r\n if( wptbActions[0] && wptbActions[0].parentNode ) {\r\n wptbActions[0].parentNode.removeChild( wptbActions[0] );\r\n wptbActionsLength--;\r\n } else {\r\n break;\r\n }\r\n \r\n } \r\n }\r\n }\r\n \r\n if( tds[i].hasAttribute( 'data-wptb-title-column' ) ) {\r\n let columnNameDivContainer = document.createElement( 'div' ),\r\n columnNameDiv = document.createElement( 'div' );\r\n columnNameDivContainer.classList.add( 'wptb-column-title-mobile-container' );\r\n columnNameDiv.classList.add( 'wptb-column-title-mobile' );\r\n columnNameDiv.dataset.wptbTitleColumn = tds[i].dataset.wptbTitleColumn;\r\n columnNameDiv.setAttribute( 'style', 'font-size:' + tds[i].dataset.wptbTitleColumnFontSize + '; \\n\\\r\n color:' + tds[i].dataset.wptbTitleColumnColor + '; background-color:' + tds[i].dataset.wptbTitleBackgroundColor + '; text-align:' + tds[i].dataset.wptbTitleAlign + ';' );\r\n columnNameDiv.style.padding = tds[i].style.padding;\r\n if( tds[i].children.length == 0 ) {\r\n tds[i].classList.add( 'wptb-column-title-mobile-not-elements' );\r\n }\r\n columnNameDivContainer.appendChild( columnNameDiv );\r\n tds[i].insertBefore( columnNameDivContainer, tds[i].firstChild );\r\n }\r\n }\r\n }\r\n \r\n return code;\r\n }\r\n}","var WPTB_Stringifier2 = function ( node, start = false ) {\r\n\r\n\tif ( node == undefined ) {\r\n\t\treturn '';\r\n\t} else if ( node.tagName == undefined && node.nodeType == 3 ) {\r\n return node.nodeValue;\r\n }\r\n \r\n let code = [],\r\n children,\r\n int_elem_arr = false,\r\n attributes = [...node.attributes],\r\n attributes_list = [],\r\n internal_elements = [];\r\n if ( ( node.parentNode.classList.contains( 'wptb-list-item-content' ) || \r\n node.parentNode.classList.contains( 'mce-content-body' ) ) && \r\n node.tagName.toLowerCase() == 'p' ) {\r\n children = node.childNodes;\r\n int_elem_arr = true;\r\n } else if( node.children.length > 0 ) {\r\n children = node.children;\r\n } else {\r\n children = node.childNodes;\r\n }\r\n if ( attributes.length > 0 ) {\r\n for ( let i = 0; i < attributes.length; i++ ) {\r\n attributes_list[i] = [attributes[i].name, attributes[i].value];\r\n }\r\n } else {\r\n attributes_list = '';\r\n }\r\n \r\n if ( children.length > 0 ) {\r\n for ( let i = 0; i < children.length; i++) {\r\n let inter_elem = WPTB_Stringifier(children[i]);\r\n \r\n if ( Array.isArray( inter_elem ) || int_elem_arr ) {\r\n internal_elements[i] = inter_elem;\r\n } else if ( typeof inter_elem === 'string' && inter_elem ) {\r\n internal_elements = inter_elem;\r\n }\r\n }\r\n } else {\r\n internal_elements = '';\r\n }\r\n \r\n \r\n code.push(node.tagName.toLowerCase(), attributes_list , internal_elements);\r\n \r\n return code;\r\n}","var array = [], WPTB_Table = function (columns, rows) {\r\n\r\n /* The members of the class */\r\n var settings = document.getElementsByClassName('wptb-settings-items'),\r\n wptbTableSetup = document.getElementsByClassName(\"wptb-table-setup\")[0],\r\n table, row, cell,\r\n maxAmountOfCells,\r\n maxAmountOfRows;\r\n\r\n //HERE ARE THE PRIVATE FUNCTIONS\r\n /*\r\n * This function toggles buttons visibility in cell edit mode\r\n * (according to the amount of currently selected cells), and\r\n * highlights visually the clicked cell if it is not highlighted, or\r\n * removes highlight if clicked cell is already highlighted. \r\n * It too toggles the bits of our abstract representation.\r\n * @param Event this is the event instance of the click performed over a cell.\r\n */\r\n var mark = function ( event ) {\r\n var rs = this.rowSpan,\r\n cs = this.colSpan,\r\n markedCells,\r\n noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n position = getCoords(this),\r\n row = position[0],\r\n column = position[1];\r\n if ( ! document.select.isActivated() ) {\r\n return;\r\n }\r\n if (this.className.match(/wptb-highlighted/)) {\r\n this.classList.remove('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 0;\r\n }\r\n }\r\n } else {\r\n this.classList.add('wptb-highlighted');\r\n for (var i = 0; i < rs; i++) {\r\n for (var j = 0; j < cs; j++) {\r\n array[row + i][column + j] = 1;\r\n }\r\n }\r\n }\r\n\r\n markedCells = document.getElementsByClassName('wptb-highlighted').length;\r\n if (markedCells === 0) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n } else if (markedCells === 1) {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.add('visible');\r\n singleCells[i].removeAttribute('disabled');\r\n }\r\n let cellHighlighted = document.querySelector( '.wptb-highlighted' );\r\n if( cellHighlighted ) {\r\n let wptbTableColumnWidthSlider = document.getElementById( 'wptb-table-column-width-slider' );\r\n let wptbTableColumnWidthNumber = document.getElementById( 'wptb-table-column-width-number' );\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n let width = cellHighlighted.style.width;\r\n if( width ) {\r\n wptbTableColumnWidthSlider.value = parseFloat( width, 10 );\r\n wptbTableColumnWidthNumber.value = parseFloat( width, 10 );\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedWidth ) {\r\n wptbTableColumnWidthSlider.value = cellHighlighted.dataset.wptbFixedWidth;\r\n wptbTableColumnWidthNumber.value = cellHighlighted.dataset.wptbFixedWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellWidth = WPTB_Helper.getColumnWidth( table, cellHighlighted );\r\n wptbTableColumnWidthSlider.value = cellWidth;\r\n wptbTableColumnWidthNumber.value = cellWidth;\r\n tableColumnWidthAutoFixedCheckbox.checked = false;\r\n }\r\n \r\n \r\n let wptbTableRowHeightSlider = document.getElementById( 'wptb-table-row-height-slider' );\r\n let wptbTableRowHeightNumber = document.getElementById( 'wptb-table-row-height-number' );\r\n let tableRowHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n let height = cellHighlighted.style.height;\r\n if( height ) {\r\n wptbTableRowHeightSlider.value = parseFloat( height, 10 );\r\n wptbTableRowHeightNumber.value = parseFloat( height, 10 );\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else if( cellHighlighted.dataset.wptbFixedHeight ) {\r\n wptbTableRowHeightSlider.value = cellHighlighted.dataset.wptbFixedHeight;\r\n wptbTableRowHeightNumber.value = cellHighlighted.dataset.wptbFixedHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = true;\r\n } else {\r\n let cellHeight = WPTB_Helper.getRowHeight( table, cellHighlighted );\r\n wptbTableRowHeightSlider.value = cellHeight;\r\n wptbTableRowHeightNumber.value = cellHeight;\r\n tableRowHeightAutoFixedCheckbox.checked = false;\r\n }\r\n }\r\n cellSettings.classList.add( 'visible' );\r\n } else {\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n if (table.isSquare(array)) {\r\n multipleCells[i].classList.add('visible');\r\n multipleCells[i].removeAttribute('disabled');\r\n } else {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.remove('visible');\r\n noCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n }\r\n };\r\n\r\n /* \r\n * This function fills an array with 1's according to the actual design\r\n * of HTML table.\r\n * @returns an array of arrays containing an abstract representation\r\n * of HTML table.\r\n * @deprecated\r\n * */\r\n\r\n var realTimeArray = function () {\r\n var carried = [], tds, cols, matriz = [];\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n cols = [];\r\n\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n\r\n for (items = 0; items < tds.length; items++) {\r\n\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n cols.push(1);\r\n }\r\n\r\n if (tds[items].rowSpan > 1) {\r\n for (var k = 0; k < tds[items].colSpan; k++) {\r\n carried[items + k] = {\r\n justAssigned: true,\r\n amount: tds[items].rowSpan\r\n };\r\n }\r\n }\r\n }\r\n\r\n for (var k = 0; k < maxAmountOfCells; k++) {\r\n if (typeof carried[k] == 'object' && carried[k].amount > 0) {\r\n carried[k].amount--;\r\n if (carried[k].justAssigned) {\r\n carried[k].justAssigned = false;\r\n } else {\r\n cols.push(1);\r\n }\r\n }\r\n }\r\n\r\n matriz.push(cols);\r\n\r\n }\r\n return matriz;\r\n };\r\n\r\n /*\r\n * This function gets the number and position of cell spaces in current row that are occuped \r\n * by upper rowspanned cells.\r\n * @param number the number of row where we wish to calculate the carried rowspans up to.\r\n * @return an array with the remaining rowspans in each column.\r\n */\r\n var carriedRowspans = function (row) {\r\n var carried = [], tds, cols;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carried[i] = 0;\r\n }\r\n\r\n if (row == -1) {\r\n return carried;\r\n }\r\n\r\n for (var i = 0; i <= row; i++) {\r\n cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (carried[xPosition]) {\r\n carried[xPosition]--;\r\n } else {\r\n celda = cellsBuffer[cellPointer++];\r\n if (celda.rowSpan > 1) {\r\n for (k = 0; k < celda.colSpan; k++) {\r\n carried[xPosition + k] = celda.rowSpan - 1;\r\n }\r\n stepsToMove = celda.colSpan;\r\n } else if (celda.colSpan > 1) {\r\n stepsToMove = celda.colSpan;\r\n }\r\n }\r\n }\r\n\r\n }\r\n return carried;\r\n };\r\n\r\n /*\r\n * A helpful function for showing\r\n * the abstract table in console.\r\n * @param Array our abstract table.\r\n */\r\n var drawTable = function (a) {\r\n var string = 'DRAWING TABLE:\\n';\r\n for (var i = 0; i < a.length; i++) {\r\n\r\n for (var j = 0; j < a[i].length; j++) {\r\n string += ' ' + a[i][j];\r\n }\r\n string += '\\n';\r\n }\r\n table.isSquare(a);\r\n };\r\n\r\n /*\r\n * It resets all the bits of our abstract representation\r\n * to 0 and removes the highlighting class of all cells.\r\n */\r\n\r\n var undoSelect = function () {\r\n var noCells = document.getElementsByClassName('wptb-no-cell-action'),\r\n singleCells = document.getElementsByClassName('wptb-single-action'),\r\n multipleCells = document.getElementsByClassName('wptb-multiple-select-action'),\r\n cellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n tds = table.getElementsByClassName('wptb-highlighted');\r\n while (tds.length) {\r\n tds[0].classList.remove('wptb-highlighted');\r\n }\r\n cellSettings.classList.remove( 'visible' );\r\n for (var i = 0; i < array.length; i++) {\r\n for (var j = 0; j < array[i].length; j++) {\r\n array[i][j] = 0;\r\n }\r\n }\r\n for (var i = 0; i < multipleCells.length; i++) {\r\n multipleCells[i].classList.remove('visible');\r\n multipleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n for (var i = 0; i < noCells.length; i++) {\r\n noCells[i].classList.add('visible');\r\n noCells[i].removeAttribute('disabled');\r\n }\r\n for (var i = 0; i < singleCells.length; i++) {\r\n singleCells[i].classList.remove('visible');\r\n singleCells[i].setAttribute('disabled', 'disabled');\r\n }\r\n };\r\n\r\n /*\r\n * This fills the abstract representation of our table with \r\n * zeros, at the start. the max amount of cells is the greatest sum\r\n * of all colspans for row.\r\n */\r\n\r\n var fillTableArray = function () {\r\n var colspansSums = [], a = [];\r\n\r\n //calculate max amount of cells inside a row\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cells = table.rows[i].getElementsByTagName('td'),\r\n colspanSumInRow = 0;\r\n for (var j = 0; j < cells.length; j++) {\r\n colspanSumInRow += cells[j].colSpan;\r\n }\r\n colspansSums.push(colspanSumInRow);\r\n }\r\n\r\n maxAmountOfCells = Math.max.apply(null, colspansSums);\r\n //calculate max rows\r\n var maxAmountOfRows = table.rows.length;\r\n\r\n // fill with zeros from both values\r\n for (var i = 0; i < maxAmountOfRows; i++) {\r\n a[i] = [];\r\n for (var j = 0; j < maxAmountOfCells; j++) {\r\n a[i].push(0);\r\n }\r\n }\r\n drawTable(a);\r\n return a;\r\n };\r\n\r\n /*\r\n * This function gets the sum of all colspans in a row.\r\n * @param number the number of row to be used as reference.\r\n */\r\n var getActualPointsInRow = function (row) {\r\n var tds = table.rows[row].getElementsByTagName('td'),\r\n points = 0;\r\n for (var i = 0; i < tds.length; i++) {\r\n points += tds[i].colSpan;\r\n }\r\n return points;\r\n }\r\n\r\n /*\r\n * This function gets us the exact coordinates of\r\n * an exact cell, in a more reliable way than xIndex and yIndex,\r\n * these last ones were meant to be used for getting the cell trough them.\r\n * @param DOMElement the cell to get the coordinates.\r\n */\r\n var getCoords = function (search) {\r\n var skipInCols = [], cell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n skipInCols[i] = 0;\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var cellsBuffer = table.rows[i].getElementsByTagName('td');\r\n cellPointer = 0;\r\n for (var xPosition = 0; xPosition < maxAmountOfCells; xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (skipInCols[xPosition]) {\r\n skipInCols[xPosition]--;\r\n } else {\r\n var td = cellsBuffer[cellPointer++];\r\n if (td == search) {\r\n return [i, xPosition];\r\n }\r\n if (td.rowSpan > 1) {\r\n for ( let k = 0; k < td.colSpan; k++ ) {\r\n skipInCols[xPosition + k] = td.rowSpan - 1;\r\n }\r\n stepsToMove = td.colSpan;\r\n } else if (td.colSpan > 1) {\r\n stepsToMove = td.colSpan;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n jQuery('#wptb-table-header-bg').val('');\r\n jQuery('#wptb-even-row-bg').val('');\r\n jQuery('#wptb-odd-row-bg').val('');\r\n jQuery('#wptb-table-border-color').val('');\r\n jQuery('#wptb-table-inner-border-number,#wptb-table-inner-border-slider').val('0');\r\n jQuery('#wptb-table-border-number,#wptb-table-border-slider').val('0');\r\n jQuery('#wptb-table-padding-number,#wptb-table-padding-slider').val('15');\r\n\r\n if (columns || rows) {\r\n //END OF PRIVATE FUNCTIONS\r\n for (var i = 0; i < settings.length; i++) {\r\n if (settings[i].id !== 'wptb-apply-inner-border') {\r\n settings[i].classList.add('visible');\r\n }\r\n }\r\n\r\n //Create a HTML Table element.\r\n table = document.createElement( 'table' );\r\n table.classList.add( 'wptb-preview-table' );\r\n table.dataset.reconstraction = 1;\r\n table.dataset.wptbAdaptiveTable = 1;\r\n //Add the data rows.\r\n for (var i = 0; i < rows; i++) {\r\n\r\n row = table.insertRow(-1);\r\n row.classList.add( 'wptb-row' );\r\n\r\n for (var j = 0; j < columns; j++) {\r\n cell = new WPTB_Cell(mark);\r\n cell.setCoords(i, j);\r\n row.appendChild(cell.getDOMElement());\r\n }\r\n }\r\n } else {\r\n let wptb_preview_table = document.getElementsByClassName( 'wptb-preview-table' );\r\n\r\n if (wptb_preview_table.length > 0) {\r\n table = wptb_preview_table[0];\r\n\r\n let cells = table.getElementsByTagName('td');\r\n\r\n if (cells.length > 0) {\r\n for (let i = 0; i < cells.length; i++) {\r\n WPTB_Cell(mark, cells[i]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * This just toggles visibility of cell edit bar, and toggles \r\n * cell selecting mode.\r\n */\r\n\r\n table.toggleTableEditMode = function () {\r\n let bar = document.getElementsByClassName('wptb-edit-bar'),\r\n cellModeBackground = document.getElementById('wptb-cell_mode_background'),\r\n leftScrollPanelCurtain = document.getElementById('wptb-left-scroll-panel-curtain'),\r\n leftScrollPanelCellSettings = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ),\r\n wptbPreviewTable = document.getElementsByClassName('wptb-preview-table');\r\n if (wptbPreviewTable.length > 0) {\r\n wptbPreviewTable = wptbPreviewTable[0];\r\n }\r\n\r\n if ( bar.length > 0 ) {\r\n for ( let i = 0; i < bar.length; i++ ) {\r\n if ( bar[i].classList.contains( 'visible' ) ) {\r\n document.select.deactivateMultipleSelectMode();\r\n bar[i].classList.remove( 'visible' );\r\n cellModeBackground.classList.remove( 'visible' );\r\n leftScrollPanelCurtain.classList.remove( 'visible' );\r\n leftScrollPanelCellSettings.classList.remove( 'visible' );\r\n wptbPreviewTable.parentNode.classList.remove( 'wptb-preview-table-manage-cells' );\r\n let wptbPreviewTableTds = wptbPreviewTable.getElementsByTagName( 'td' );\r\n if ( wptbPreviewTableTds.length > 0 ) {\r\n for ( let i = 0; i < wptbPreviewTableTds.length; i++ ) {\r\n wptbPreviewTableTds[i].classList.remove( 'wptb-highlighted' );\r\n }\r\n }\r\n } else {\r\n document.select.activateMultipleSelectMode();\r\n bar[i].classList.add( 'visible' );\r\n cellModeBackground.classList.add( 'visible' );\r\n leftScrollPanelCurtain.classList.add( 'visible' );\r\n wptbPreviewTable.parentNode.classList.add( 'wptb-preview-table-manage-cells' );\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n /*\r\n * For assigning to each cell xIndex and y Index attributes,\r\n * these are the column number and row number of cell in table. \r\n */\r\n\r\n table.recalculateIndexes = function ( start ) {\r\n let trs = this.getElementsByTagName('tr'), tds, maxCols = 0, maxColsFull = 0,\r\n tdsArr = [];\r\n let wptbTopRowAsHeader = document.getElementById( 'wptb-top-row-as-header' );\r\n \r\n for (var i = 0; i < trs.length; i++) {\r\n if ( i == 0 ) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-table-header-bg').val();\r\n }\r\n if( wptbTopRowAsHeader.checked ) {\r\n if( start == undefined ) {\r\n this.classList.add( 'wptb-table-preview-head' ); \r\n trs[i].classList.add( 'wptb-table-head' )\r\n } ;\r\n } else {\r\n if( start == undefined ) {\r\n this.classList.remove( 'wptb-table-preview-head' );\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n } else {\r\n if (i % 2 == 0) {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-odd-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n } else {\r\n if ( start == undefined ) {\r\n trs[i].style.backgroundColor = jQuery('#wptb-even-row-bg').val();\r\n }\r\n trs[i].classList.remove( 'wptb-table-head' );\r\n }\r\n }\r\n\r\n tdsArr[i];\r\n tds = trs[i].getElementsByTagName('td');\r\n\r\n if (tdsArr[i] == undefined) {\r\n tdsArr[i] = [];\r\n }\r\n\r\n let jMainIter = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tdsArr[i][j] != undefined) {\r\n for (let y = 0; y < 100; y++) {\r\n if (tdsArr[i][jMainIter] != undefined) {\r\n jMainIter++;\r\n continue;\r\n }\r\n tdsArr[i][jMainIter] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n break;\r\n }\r\n } else {\r\n tdsArr[i][j] = tds[j];\r\n tds[j].dataset.xIndex = jMainIter;\r\n }\r\n tds[j].dataset.yIndex = i;\r\n\r\n if (tds[j].colSpan > 1) {\r\n for (let k = 1; k < tds[j].colSpan; k++) {\r\n jMainIter++;\r\n tdsArr[i][jMainIter] = 'tdDummy';\r\n }\r\n }\r\n\r\n if (tds[j].rowSpan > 1) {\r\n for (let x = 1; x < tds[j].rowSpan; x++) {\r\n if (tdsArr[i + x] == undefined) {\r\n tdsArr[i + x] = [];\r\n }\r\n for (let z = 0; z < tds[j].colSpan; z++) {\r\n tdsArr[i + x][jMainIter - tds[j].colSpan + 1 + z ] = 'tdDummy';\r\n }\r\n }\r\n }\r\n jMainIter++;\r\n if( i == 0 ) {\r\n maxColsFull = jMainIter;\r\n }\r\n }\r\n if (j > maxCols) {\r\n maxCols = j;\r\n }\r\n }\r\n this.columns = maxCols;\r\n this.maxCols = maxColsFull;\r\n }\r\n \r\n table.addColumnWidth = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataXIndex = highlighted[k].dataset.xIndex;\r\n if( dataXIndex ) {\r\n function tableTdsFor( dataXIndex, colspan ) {\r\n let tableRows = table.rows;\r\n let widthIsSet = false;\r\n let arrayTdsFromPreviousRow = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.xIndex == dataXIndex ) {\r\n if( value ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n widthIsSet = true;\r\n let tableColumnWidthAutoFixedCheckbox = document.getElementById( 'wptb-table-column-width-auto-fixed' );\r\n if( ! tableColumnWidthAutoFixedCheckbox.checked ) {\r\n tableColumnWidthAutoFixedCheckbox.checked = true;\r\n }\r\n } else {\r\n td.style.width = null;\r\n td.dataset.wptbFixedWidth = value;\r\n if( i == tableRows.length - 1 && ! widthIsSet ) {\r\n tableTdsFor( dataXIndex, colspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.width = null;\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } else {\r\n if( td.dataset.wptbFixedWidth ) {\r\n if( td.colSpan == colspan ) {\r\n td.style.width = td.dataset.wptbFixedWidth + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n } \r\n } else if( td.style.width ) {\r\n for( let z = 0; z < arrayTdsFromPreviousRow.length; z++ ) {\r\n arrayTdsFromPreviousRow[z].style.width = td.style.width;\r\n }\r\n arrayTdsFromPreviousRow = [];\r\n } else {\r\n arrayTdsFromPreviousRow.push( td );\r\n }\r\n }\r\n break;\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataXIndex, 1 );\r\n }\r\n }\r\n \r\n table.tdDefaultWidth();\r\n }\r\n }\r\n \r\n table.tdDefaultWidth = function() {\r\n let rows = table.rows;\r\n \r\n let tableTdsSumMaxWidth = 0;\r\n let tableTdsSumMaxWidthFixed = 0;\r\n let tableTdsSumMaxWidthAuto = 0;\r\n \r\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' )[0];\r\n let wptbTableSetupWidth = wptbTableSetup.offsetWidth;\r\n \r\n let arrayCellsWidthFixedHelper = [];\r\n let arrayCellsWidthAutoHelper = [];\r\n let tdPaddingCommon = 0;\r\n let tableTdBorderCommonWidth = 0;\r\n let cssForTdsWidthAuto = '';\r\n \r\n for( let i = 0; i < rows.length; i++ ) {\r\n let tds = rows[i].children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n \r\n if( ! arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] && ! arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( td.style.width ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] = parseFloat( td.style.width );\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n } else {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] = 100;\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n }\r\n \r\n if( window.getComputedStyle( td, null ) ) {\r\n let tdStyleObj = window.getComputedStyle( td, null );\r\n let tdPaddingLeft = tdStyleObj.getPropertyValue( 'padding-left' );\r\n let tdPaddingRight = tdStyleObj.getPropertyValue( 'padding-right' );\r\n tdPaddingCommon = parseFloat( tdPaddingLeft, 10 ) + parseFloat( tdPaddingRight, 10 );\r\n\r\n let tableTdBorderLeftWidth = tdStyleObj.getPropertyValue( 'border-left-width' );\r\n let tableTdBorderRightWidth = tdStyleObj.getPropertyValue( 'border-right-width' );\r\n tableTdBorderCommonWidth = parseFloat( tableTdBorderLeftWidth, 10 ) + parseFloat( tableTdBorderRightWidth, 10 );\r\n if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n } else {\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tdPaddingCommon;\r\n arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] += tableTdBorderCommonWidth;\r\n }\r\n }\r\n } else if( arrayCellsWidthAutoHelper[parseInt( td.dataset.xIndex )] ) {\r\n if( ! td.dataset.wptbFixedWidth ) {\r\n td.dataset.wptbCssTdAutoWidth = true;\r\n }\r\n } else if( arrayCellsWidthFixedHelper[parseInt( td.dataset.xIndex )] ) {\r\n td.removeAttribute( 'data-wptb-css-td-auto-width' );\r\n }\r\n }\r\n }\r\n \r\n for( let i = 0; i < arrayCellsWidthFixedHelper.length; i++ ) {\r\n if( arrayCellsWidthFixedHelper[i] ) {\r\n tableTdsSumMaxWidthFixed += arrayCellsWidthFixedHelper[i];\r\n }\r\n }\r\n \r\n let CellsWidthAutoCount = 0;\r\n for( let i = 0; i < arrayCellsWidthAutoHelper.length; i++ ) {\r\n if( arrayCellsWidthAutoHelper[i] ) {\r\n tableTdsSumMaxWidthAuto += arrayCellsWidthAutoHelper[i];\r\n CellsWidthAutoCount++;\r\n }\r\n }\r\n \r\n let tableFullStyleObj = window.getComputedStyle( table, null );\r\n let borderLeftWidth = tableFullStyleObj.getPropertyValue( 'border-left-width' );\r\n let borderRightWidth = tableFullStyleObj.getPropertyValue( 'border-right-width' );\r\n let tableBorderCommon = parseFloat( borderLeftWidth, 10 ) + parseFloat( borderRightWidth, 10 );\r\n tableTdsSumMaxWidth = tableTdsSumMaxWidthFixed + tableTdsSumMaxWidthAuto + tableBorderCommon;\r\n \r\n table.dataset.wptbTableTdsSumMaxWidth = tableTdsSumMaxWidth;\r\n if( CellsWidthAutoCount ) {\r\n table.dataset.wptbCellsWidthAutoCount = CellsWidthAutoCount;\r\n if( table.mergingСellsHorizontally ) {\r\n table.dataset.wptbFixedWidthSize = tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n }\r\n } else {\r\n table.removeAttribute( 'data-wptb-fixed-width-size' );\r\n table.removeAttribute( 'data-wptb-cells-width-auto-count' );\r\n }\r\n \r\n let styleElementCreate = false;\r\n let tableTdWidthAuto;\r\n if( tableTdsSumMaxWidth < wptbTableSetupWidth ) {\r\n if( CellsWidthAutoCount ) {\r\n table.style.minWidth = '100%';\r\n if( table.mergingСellsHorizontally ) {\r\n table.style.width = null;\r\n let tableTdsWidthAutoCommon = wptbTableSetupWidth - tableTdsSumMaxWidthFixed - tableBorderCommon;\r\n tableTdWidthAuto = tableTdsWidthAutoCommon / CellsWidthAutoCount;\r\n tableTdWidthAuto = tableTdWidthAuto - tdPaddingCommon - tableTdBorderCommonWidth;\r\n styleElementCreate = true;\r\n } else {\r\n table.style.width = '100%';\r\n }\r\n } else {\r\n table.style.width = null;\r\n table.style.minWidth = null;\r\n table.style.maxWidth = tableTdsSumMaxWidth + 'px';\r\n }\r\n } else {\r\n table.style.maxWidth = null;\r\n table.style.minWidth = tableTdsSumMaxWidth + 'px';\r\n table.style.width = null;\r\n tableTdWidthAuto = '100'\r\n styleElementCreate = true;\r\n }\r\n \r\n let head = document.head;\r\n if( head ) {\r\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\r\n if( cssForTdsWidthAutoOld ) {\r\n head.removeChild( cssForTdsWidthAutoOld );\r\n }\r\n }\r\n \r\n if( styleElementCreate ) {\r\n cssForTdsWidthAuto = document.createElement( 'style' );\r\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\r\n cssForTdsWidthAuto.innerHTML = '[data-wptb-css-td-auto-width=true]{width:' + tableTdWidthAuto + 'px}';\r\n if( head ) {\r\n head.appendChild( cssForTdsWidthAuto );\r\n }\r\n }\r\n }\r\n \r\n table.addRowHeight = function( value, cleaner ) {\r\n let highlighted = table.getElementsByClassName( 'wptb-highlighted' );\r\n if( highlighted.length > 0 ) {\r\n for( let k = 0; k < highlighted.length; k++ ) {\r\n let dataYIndex = highlighted[k].dataset.yIndex;\r\n if( dataYIndex ) {\r\n function tableTdsFor( dataYIndex, rowspan ) {\r\n let tableRows = table.rows;\r\n let heightIsSet = false;\r\n let arrayTdsPrevious = [];\r\n for( let i = 0; i < tableRows.length; i++ ) {\r\n let row = tableRows[i];\r\n let tds = row.children;\r\n for( let j = 0; j < tds.length; j++ ) {\r\n let td = tds[j];\r\n if( td.dataset.yIndex == dataYIndex ) {\r\n if( value ) {\r\n if( td.rowSpan == rowspan ) {\r\n td.style.height = value + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n heightIsSet = true;\r\n let tableColumnHeightAutoFixedCheckbox = document.getElementById( 'wptb-table-row-height-auto-fixed' );\r\n if( ! tableColumnHeightAutoFixedCheckbox.checked ) {\r\n tableColumnHeightAutoFixedCheckbox.checked = true;\r\n }\r\n continue;\r\n } else {\r\n td.style.height = null;\r\n td.dataset.wptbFixedHeight = value;\r\n if( j == tds.length - 1 && ! heightIsSet ) {\r\n tableTdsFor( dataYIndex , rowspan + 1 );\r\n }\r\n }\r\n } else if( cleaner ) {\r\n td.style.height = null;\r\n td.removeAttribute( 'data-wptb-fixed-heidht' );\r\n } else {\r\n if( td.dataset.wptbFixedHeight ) {\r\n if( td.rowSpan = rowspan ) {\r\n td.style.height = td.dataset.wptbFixedHeight + 'px';\r\n td.removeAttribute( 'data-wptb-fixed-width' );\r\n }\r\n } else if( td.style.height ) {\r\n for( let z = 0; z < arrayTdsPrevious.length; z++ ) {\r\n arrayTdsPrevious[z].style.height = td.style.height;\r\n }\r\n arrayTdsPrevious = [];\r\n } else {\r\n arrayTdsPrevious.push( td );\r\n }\r\n }\r\n } \r\n }\r\n }\r\n }\r\n \r\n tableTdsFor( dataYIndex, 1 );\r\n }\r\n }\r\n }\r\n }\r\n \r\n table.reconstraction = function() {\r\n let tds = table.getElementsByTagName( 'td' );\r\n let wptbAdaptiveTableChoseBlock = document.getElementsByClassName( 'wptb-adaptive-table-chose-block' );\r\n if( wptbAdaptiveTableChoseBlock.length > 0 ) {\r\n wptbAdaptiveTableChoseBlock = wptbAdaptiveTableChoseBlock[0];\r\n }\r\n table.mergingСellsHorizontally = false;\r\n table.mergingCellsVertically = false;\r\n table.dataset.reconstraction = 1;\r\n wptbAdaptiveTableChoseBlock.style.display = 'block';\r\n let forBreak = 0;\r\n for( let i = 0; i < tds.length; i++ ) {\r\n if( tds[i].colSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingСellsHorizontally = true;\r\n forBreak++;\r\n }\r\n \r\n if( tds[i].rowSpan > 1 ) {\r\n table.dataset.reconstraction = 0;\r\n wptbAdaptiveTableChoseBlock.style.display = 'none';\r\n table.mergingCellsVertically = true;\r\n forBreak++;\r\n }\r\n \r\n if( forBreak == 2 ) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * As simple as it is: adds a column to the end of table.\r\n */\r\n table.addColumnEnd = function () {\r\n let td,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n \r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n \r\n table.rows[i].appendChild(td.getDOMElement());\r\n array[i].push(0);\r\n }\r\n \r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * As simple as it looks: adds a column to the start of table.\r\n */\r\n\r\n table.addColumnStart = function () {\r\n let td,\r\n firstCell,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n if ( currentTable.length > 0 ) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if ( currentTableTd ) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n \r\n for (var i = 0; i < table.rows.length; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n firstCell = table.rows[i].getElementsByTagName('td')[0];\r\n if (firstCell) {\r\n table.rows[i].insertBefore(td.getDOMElement(), firstCell);\r\n } else {\r\n table.rows[i].appendChild(td.getDOMElement());\r\n }\r\n array[i].push(0);\r\n }\r\n\r\n maxAmountOfCells++;\r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Well, not so simple as previous functions.\r\n * It adds a column after a certain column of reference.\r\n * @param integer the column number to be used as reference.\r\n *\tIf empty, then the first highlighted cell is used as reference.\r\n */\r\n\r\n table.addColumnAfter = function (c_pos) {\r\n let rows = table.rows,\r\n cellPointer,\r\n cellsBuffer,\r\n cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n pos = c_pos != undefined && typeof c_pos === 'number' ? c_pos : getCoords(cell)[1];\r\n \r\n \r\n \r\n if( maxAmountOfCells - pos - cell.colSpan + 1 == 1 ) {\r\n table.addColumnEnd();\r\n } else {\r\n let pendingInsertion = false,\r\n stepsToMove,\r\n td, bro,\r\n carriedRowspans = [],\r\n currentCell;\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n carriedRowspans.push(0);\r\n }\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n cellPointer = 0;\r\n cellsBuffer = rows[i].getElementsByTagName('td');\r\n pendingInsertion = false;\r\n for (var xPosition = 0;\r\n xPosition < maxAmountOfCells;\r\n xPosition += stepsToMove) {\r\n stepsToMove = 1;\r\n\r\n if (pendingInsertion) {\r\n td = new WPTB_Cell(mark);\r\n if (cellStyle) {\r\n td.getDOMElement().setAttribute('style', cellStyle);\r\n td.getDOMElement().style.width = null;\r\n }\r\n if (currentCell && rows[i].contains(currentCell)) {\r\n bro = currentCell.nextSibling;\r\n if (bro) {\r\n rows[i].insertBefore(td.getDOMElement(), bro);\r\n } else {\r\n rows[i].appendChild(td.getDOMElement());\r\n }\r\n } else {\r\n rows[i].insertBefore(td.getDOMElement(), cellsBuffer[0]);\r\n }\r\n break;\r\n } else if (carriedRowspans[xPosition] > 0) {\r\n // If no pending insertion, let's check if no rowspan from upper cells is pending in current position\r\n if (pos == xPosition) {\r\n pendingInsertion = true;\r\n }\r\n } else {\r\n currentCell = cellsBuffer[cellPointer++];\r\n if (currentCell.rowSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n carriedRowspans[xPosition + k] = currentCell.rowSpan;\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (currentCell.colSpan > 1) {\r\n stepsToMove = currentCell.colSpan;\r\n for (var k = 0; k < currentCell.colSpan; k++) {\r\n if (xPosition + k == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n } else if (xPosition == pos) {\r\n pendingInsertion = true;\r\n }\r\n }\r\n }\r\n\r\n for (var l = 0; l < maxAmountOfCells; l++) {\r\n if (carriedRowspans[l] > 0)\r\n carriedRowspans[l]--;\r\n }\r\n\r\n }\r\n\r\n for (var i = 0; i < array.length; i++) {\r\n array[i].push(0);\r\n }\r\n maxAmountOfCells++;\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n };\r\n\r\n /*\r\n * For preventing us to take a lot of time,\r\n * This is just calling the function addColumnAfter, but\r\n * using the previous column to current one as reference.\r\n * @see addColumnAfter\r\n */\r\n\r\n table.addColumnBefore = function () {\r\n var cell = document.querySelector('.wptb-highlighted'),\r\n pos = getCoords(cell)[1];\r\n\r\n if (pos === 0) {\r\n table.addColumnStart();\r\n } else {\r\n table.addColumnAfter(pos - 1);\r\n }\r\n };\r\n\r\n /*\r\n * Luckily, thisfunction is simple, \r\n * it just add a row to the end of table.\r\n */\r\n\r\n table.addRowToTheEnd = function () {\r\n let r = table.insertRow(-1),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Yet another simple function, \r\n * it just add a row to the start of table.\r\n */\r\n\r\n table.addRowToTheStart = function () {\r\n let r = table.insertRow(0),\r\n td,\r\n aux,\r\n currentTable = document.getElementsByClassName('wptb-preview-table'),\r\n currentTableTd,\r\n currentTdStyle;\r\n r.classList.add( 'wptb-row' );\r\n if (currentTable.length > 0) {\r\n currentTableTd = currentTable[0].querySelector('td');\r\n }\r\n\r\n if (currentTableTd) {\r\n currentTdStyle = currentTableTd.getAttribute('style');\r\n }\r\n\r\n for (var i = 0; i < maxAmountOfCells; i++) {\r\n td = new WPTB_Cell(mark);\r\n if (currentTdStyle) {\r\n td.getDOMElement().setAttribute('style', currentTdStyle);\r\n }\r\n r.appendChild(td.getDOMElement());\r\n }\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /* \r\n * This function adds a row before the current one.\r\n * Since the biggest factor of problem is a not-started but ongoing rowspan,\r\n * the most of the troubles is not here.\r\n */\r\n\r\n table.addRowBefore = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellNew;\r\n for( let i = row - 1; i >= 0; i-- ) {\r\n let rowChildren = table.rows[i].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for( let j = 0; j < rowChildrenLength; j++ ) {\r\n if( rowChildren[j].rowSpan == 1 ) {\r\n row = i;\r\n cellNew = true;\r\n break;\r\n }\r\n }\r\n }\r\n if ( cellNew ) {\r\n break;\r\n }\r\n }\r\n\r\n if (row === 0) {\r\n table.addRowToTheStart();\r\n } else {\r\n table.addRowAfter( row, cellStyle );\r\n }\r\n };\r\n\r\n /*\r\n * Well... by the name convention of the previous 3 functions,\r\n * it's pretty obvious that this functions attaches a new\r\n * row after highlighted cell row. The greatest obstacle it was\r\n * the possibility of a TR not having the exact amount of columns\r\n * occuped by actual node but rowspanned upper cells. For that purpose\r\n * it was created the function realTimeArray.\r\n * @see realTimeArray\r\n */\r\n\r\n table.addRowAfter = function ( row, cellStyle ) {\r\n let cellRowSpan,\r\n rowAfter,\r\n aux;\r\n \r\n if ( ( row == undefined || typeof row !== 'number' ) && cellStyle == undefined ) {\r\n let cell = document.querySelector('.wptb-highlighted');\r\n cellStyle = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n cellRowSpan = cell.rowSpan,\r\n rowAfter = row + cellRowSpan - 1;\r\n } else {\r\n rowAfter = row;\r\n }\r\n \r\n \r\n let cellsColSpan = 0;\r\n if ( rowAfter < table.rows.length -1 ) {\r\n for( let i = 0; i <= rowAfter ; i++ ) {\r\n let tableRowsIChildren = table.rows[i].children,\r\n tableRIChildrenLength = tableRowsIChildren.length;\r\n if( tableRIChildrenLength > 0 ) {\r\n for( let j = 0; j < tableRIChildrenLength; j++ ) {\r\n let rowIRowSpan = tableRowsIChildren[j].rowSpan;\r\n\r\n if ( rowIRowSpan - 1 + i > rowAfter ) {\r\n tableRowsIChildren[j].rowSpan++;\r\n }\r\n }\r\n }\r\n }\r\n \r\n let rNext = table.rows[rowAfter + 1],\r\n rNextChildren = rNext.children,\r\n rNextChildrenLength = rNextChildren.length;\r\n \r\n if( rNextChildrenLength > 0 ) {\r\n for ( let i = 0; i < rNextChildrenLength; i++ ) {\r\n cellsColSpan += rNextChildren[i].colSpan;\r\n }\r\n }\r\n } else {\r\n cellsColSpan = array[0].length;\r\n }\r\n \r\n let r = table.insertRow( rowAfter + 1 );\r\n r.classList.add( 'wptb-row' );\r\n \r\n for ( j = 0; j < cellsColSpan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyle );\r\n td.getDOMElement().style.width = null;\r\n td.getDOMElement().style.height = null;\r\n r.appendChild( td.getDOMElement() );\r\n }\r\n\r\n aux = Array.from(array[0]);\r\n array.push(aux);\r\n drawTable(array);\r\n table.recalculateIndexes();\r\n table.addColumnWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This function checks the current selected cells\r\n * make a rectangular shape.\r\n * @param Array the abstract table.\r\n * @return false, if not making a rectangle, or\r\n *\tArray an array containing number of rows and columns, if selection makes a rectangle.\r\n */\r\n\r\n table.isSquare = function (a) {\r\n var rowStart = -1,\r\n columnStart = -1,\r\n rowEnd = -1,\r\n columnEnd = -1,\r\n height,\r\n width,\r\n itemsEstimate = 0,\r\n items = 0;\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n if ( j < columnStart || columnStart == -1 ) {\r\n columnStart = j;\r\n }\r\n if ( i < rowStart || rowStart == -1 ) {\r\n rowStart = i;\r\n }\r\n }\r\n }\r\n \r\n }\r\n\r\n for (var i = a.length - 1; i > -1; i--) {\r\n for (var j = a[i].length - 1; j > -1; j--) {\r\n if (a[i][j] == 1) {\r\n if ( j > columnEnd ) {\r\n columnEnd = j;\r\n }\r\n if ( i > rowEnd ) {\r\n rowEnd = i;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = rowStart; i < rowEnd; i++) {\r\n for (var j = columnStart; j < columnEnd; j++) {\r\n if (a[i][j] == 0 || a[i][j] == undefined) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < a.length; i++) {\r\n for (var j = 0; j < a[i].length; j++) {\r\n if (a[i][j] == 1) {\r\n items++;\r\n }\r\n }\r\n }\r\n\r\n height = rowEnd - rowStart + 1;\r\n width = columnEnd - columnStart + 1;\r\n itemsEstimate = height * width;\r\n\r\n if (itemsEstimate !== items) {\r\n return false;\r\n }\r\n return [height, width];\r\n };\r\n\r\n /*\r\n * This function merges all selected cells.\r\n * Well, actually sets the colspan and rowspan of first \r\n * upper left cell in selection and deletes the another selected cells.\r\n */\r\n\r\n table.mergeCells = function () {\r\n var dimensions = table.isSquare(array),\r\n rowspan = dimensions[0],\r\n colspan = dimensions[1],\r\n first = document.querySelector('.wptb-highlighted'),\r\n tds = [].slice.call(document.getElementsByClassName('wptb-highlighted'), 1),\r\n tdsChildrenNew = [];\r\n\r\n for (let i = 0; i < tds.length; i++) {\r\n let tdsInternalElements = tds[i].getElementsByClassName('wptb-ph-element');\r\n if (tdsInternalElements.length > 0) {\r\n let tdsIntElemLength = tdsInternalElements.length;\r\n for (let j = 0; j < tdsIntElemLength; j++) {\r\n tdsChildrenNew.push(tdsInternalElements[j]);\r\n }\r\n }\r\n let p = tds[i].parentNode;\r\n p.removeChild(tds[i]);\r\n }\r\n if (tdsChildrenNew.length > 0) {\r\n for (let i = 0; i < tdsChildrenNew.length; i++) {\r\n first.appendChild(tdsChildrenNew[i]);\r\n }\r\n }\r\n\r\n first.colSpan = colspan;\r\n first.rowSpan = rowspan;\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n let firstWidth = first.style.width;\r\n let firstDataFixedWidth = first.dataset.wptbFixedWidth;\r\n if( firstWidth ) {\r\n table.addColumnWidth( parseFloat( firstWidth, 10 ) );\r\n } else if( firstDataFixedWidth ) {\r\n table.addColumnWidth();\r\n } else {\r\n table.addColumnWidth( false, true );\r\n }\r\n \r\n let firstHeight = first.style.height;\r\n let firstDataFixedHeight = first.dataset.wptbFixedHeight;\r\n if( firstHeight ) {\r\n table.addRowHeight( parseFloat( firstHeight, 10 ) );\r\n } else if( firstDataFixedHeight ) {\r\n table.addRowHeight();\r\n } else {\r\n table.addRowHeight( false, true );\r\n }\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * This functions makes the exact inverse as above.\r\n * It resets colspan and rowspan and appends \r\n * the same amount in cells to the table.\r\n * @bug\r\n */\r\n\r\n table.splitCell = function () {\r\n var cell = document.getElementsByClassName('wptb-highlighted')[0],\r\n rowspan = cell.rowSpan,\r\n colspan = cell.colSpan,\r\n cellStyles = cell.getAttribute('style'),\r\n row = getCoords(cell)[0],\r\n thisRow = table.rows[row],\r\n cellXIndex =cell.dataset.xIndex;\r\n \r\n cell.rowSpan = 1;\r\n cell.colSpan = 1;\r\n \r\n for (let i = 1; i < colspan; i++) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().classList.add( 'wptb-highlighted' );\r\n if ( cell.nextSibling ) {\r\n thisRow.insertBefore( td.getDOMElement(), cell.nextSibling );\r\n } else {\r\n thisRow.appendChild( td.getDOMElement() );\r\n }\r\n \r\n }\r\n\r\n if (rowspan > 1) {\r\n for (let i = 1; i < rowspan; i++) {\r\n let rowChildInsertBefore = undefined,\r\n rowNext = table.rows[row + i],\r\n rowChildren = rowNext.children,\r\n rowChildrenLength = rowChildren.length;\r\n \r\n if ( rowChildrenLength > 0 ) {\r\n for ( let k = 0; k < rowChildrenLength; k++ ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) > Number( cellXIndex ) ) {\r\n rowChildInsertBefore = rowChildren[k];\r\n break;\r\n } \r\n }\r\n }\r\n for ( let j = 0; j < colspan; j++ ) {\r\n let td = new WPTB_Cell( mark );\r\n td.getDOMElement().setAttribute( 'style', cellStyles );\r\n if ( rowChildInsertBefore != undefined ) {\r\n rowNext.insertBefore( td.getDOMElement(), rowChildInsertBefore );\r\n } else {\r\n rowNext.appendChild( td.getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n\r\n table.recalculateIndexes();\r\n table.reconstraction();\r\n table.addColumnWidth();\r\n table.addRowHeight();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n /*\r\n * Searches for rowspanned cells up to row number meeting it.\r\n * @param number the number of row where the function\r\n * must search up to.\r\n */\r\n\r\n table.findRowspannedCells = function (row) {\r\n var array = [],\r\n difference;\r\n actualPoints = getActualPointsInRow(row);\r\n if (actualPoints === maxAmountOfCells) {\r\n return [];\r\n }\r\n difference = maxAmountOfCells - actualPoints;\r\n\r\n for (var i = row - 1; i >= 0 && difference; i--) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var i = 0; i < tds.length; i++) {\r\n if (tds[i].rowSpan > 1) {\r\n array.push(tds[i]);\r\n difference -= tds[i].colSpan;\r\n }\r\n }\r\n }\r\n return array;\r\n\r\n }\r\n\r\n /*\r\n * This function explores the table and adds \r\n * a cell for each lacking one for each row\r\n * to meet an even amount of cells.\r\n */\r\n\r\n table.addLackingCells = function () {\r\n var sumRows = [];\r\n for (var i = 0; i < table.rows.length; i++) {\r\n sumRows.push(0);\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td');\r\n for (var j = 0; j < tds.length; j++) {\r\n if (tds[j].rowSpan > 1) {\r\n for (var k = 1; k < tds[j].rowSpan; k++) {\r\n sumRows[i + k]++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (var i = 0; i < table.rows.length; i++) {\r\n var tds = table.rows[i].getElementsByTagName('td'),\r\n totalColspan = 0;\r\n for (var j = 0; j < tds.length; j++) {\r\n totalColspan += tds[j].colSpan;\r\n }\r\n totalColspan += sumRows[i];\r\n difference = maxAmountOfCells - totalColspan;\r\n for (var j = 0; j < difference; j++) {\r\n var td = new WPTB_Cell(mark);\r\n table.rows[i].appendChild(td.getDOMElement());\r\n //table.rows[i].insertBefore( td.getDOMElement(), rows[i].nextSibling );\r\n }\r\n }\r\n };\r\n\r\n /*\r\n * This function deletes the row of currently\r\n * selected cell. \r\n */\r\n\r\n table.deleteRow = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellStyles = cell.getAttribute('style'),\r\n rowspan = cell.rowSpan,\r\n row = getCoords(cell)[0],\r\n thisRow,\r\n aux;\r\n \r\n if ( rowspan == undefined ) rowspan = 1;\r\n \r\n for ( let i = 0; i < rowspan; i++ ) {\r\n thisRow = table.rows[row];\r\n let thisRowChildren = thisRow.children,\r\n nextRow = table.rows[row + 1],\r\n nextRowChildren,\r\n nextRowChildrenLength,\r\n tdArr = [];\r\n\r\n if( nextRow != undefined ) {\r\n nextRowChildren = nextRow.children;\r\n nextRowChildrenLength = nextRowChildren.length;\r\n for (let j = 0; j < thisRowChildren.length; j++) {\r\n if ( thisRowChildren[j].rowSpan > 1 ) {\r\n let td = new WPTB_Cell(mark);\r\n td.getDOMElement().setAttribute('style', cellStyles);\r\n td.getDOMElement().colSpan = thisRowChildren[j].colSpan;\r\n td.getDOMElement().rowSpan = thisRowChildren[j].rowSpan - 1;\r\n\r\n let nextRowChildrenK = undefined;\r\n for ( let k = 0; k < nextRowChildrenLength; k++ ) {\r\n if ( Number( nextRowChildren[k].dataset.xIndex ) > Number( thisRowChildren[j].dataset.xIndex ) ) {\r\n nextRowChildrenK = nextRowChildren[k];\r\n break;\r\n } \r\n }\r\n\r\n if ( nextRowChildrenK ) {\r\n tdArr.push( [td, nextRowChildrenK] );\r\n } else {\r\n tdArr.push( [td] );\r\n }\r\n }\r\n }\r\n\r\n if ( tdArr.length > 0 ) {\r\n for ( let k = 0; k < tdArr.length; k++ ) {\r\n if ( tdArr[k][1] != undefined ) {\r\n nextRow.insertBefore( tdArr[k][0].getDOMElement(), tdArr[k][1] );\r\n } else {\r\n nextRow.appendChild( tdArr[k][0].getDOMElement() );\r\n }\r\n }\r\n }\r\n }\r\n \r\n let tableRows = table.rows;\r\n if ( tableRows.length > 0 ) {\r\n for ( let j = 0; j < row; j++ ) {\r\n let jRowChildren = tableRows[j].children;\r\n if ( jRowChildren.length > 0 ) {\r\n for ( let x = 0; x < jRowChildren.length; x++ ) {\r\n if ( jRowChildren[x].rowSpan - 1 >= row - j ) {\r\n jRowChildren[x].rowSpan--;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n aux = Array.from(array[0]);\r\n array.pop(aux);\r\n drawTable(array);\r\n table.getElementsByTagName('tbody')[0].removeChild(table.rows[row]);\r\n \r\n if( table.rows.length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n }\r\n\r\n /*\r\n * This function deletes the column of currently\r\n * selected cell. Again, this is way more complicated than\r\n * delete row case.\r\n */\r\n\r\n table.deleteColumn = function () {\r\n let cell = document.querySelector('.wptb-highlighted'),\r\n cellXIndex = cell.dataset.xIndex,\r\n colspan = cell.colSpan;\r\n \r\n for ( let i = 0; i < colspan; i++ ) {\r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n let rowChildren = table.rows[j].children;\r\n let rowChildrenLength = rowChildren.length;\r\n if( rowChildrenLength > 0 ) {\r\n for ( let k = rowChildrenLength - 1; k >= 0; k-- ) {\r\n if ( Number( rowChildren[k].dataset.xIndex ) == Number( cellXIndex ) ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n } else {\r\n table.rows[j].removeChild( rowChildren[k] );\r\n }\r\n break;\r\n } else if( Number( rowChildren[k].dataset.xIndex ) < Number( cellXIndex ) && \r\n Number( rowChildren[k].dataset.xIndex ) + \r\n Number( rowChildren[k].colSpan -1 ) >= cellXIndex ) {\r\n if ( rowChildren[k].colSpan > 1 ) {\r\n rowChildren[k].colSpan--;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n \r\n for ( let j = 0; j < table.rows.length; j++ ) {\r\n if (array[j] != undefined)\r\n array[j].pop();\r\n }\r\n \r\n maxAmountOfCells--;\r\n \r\n if( table.querySelectorAll( 'td' ).length == 0 ) {\r\n table.toggleTableEditMode();\r\n wptbTableSetup.innerHTML = '';\r\n WPTB_Helper.settingsPanelClear();\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'table';\r\n }\r\n \r\n table.recalculateIndexes();\r\n table.tdDefaultWidth();\r\n WPTB_Helper.dataTitleColumnSet( table );\r\n }\r\n \r\n undoSelect();\r\n let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();\r\n wptbTableStateSaveManager.tableStateSet();\r\n };\r\n\r\n document.getElementsByClassName('wptb-table-generator')[0].style.display = 'none';\r\n\r\n array = fillTableArray();\r\n\r\n undoSelect();\r\n drawTable(array);\r\n\r\n wptbTableSetup.appendChild(table);\r\n //if (columns || rows) {\r\n table.recalculateIndexes( true );\r\n //}\r\n table.reconstraction();\r\n table.tdDefaultWidth();\r\n \r\n wptbTableSetup.onresize = function() {\r\n table.tdDefaultWidth();\r\n };\r\n\r\n WPTB_LeftPanel();\r\n \r\n // this code gets the ID of the active element in the toolbar \r\n // and stores it in the data attribute of the common container element \"wpcd_fixed_toolbar\"\r\n// let wptbPhElement = document.getElementsByClassName( 'wptb-ph-element' );\r\n// let wpcdFixedToolbar = document.getElementById( 'wpcd_fixed_toolbar' );\r\n// for ( let i = 0; i < wptbPhElement.length; i++ ) {\r\n// wptbPhElement[i].addEventListener( 'click', function( e ) {\r\n// let wptbToolbar = document.getElementById( 'wpcd_fixed_toolbar' ).children;\r\n// for ( let j = 0; j < wptbToolbar.length; j++ ) {\r\n// let elementStyles = window.getComputedStyle( wptbToolbar[j], 'null' );\r\n// if( elementStyles.getPropertyValue( 'display' ) == 'block' ) {\r\n// wpcdFixedToolbar.dataset.toolbarActiveId = wptbToolbar[j].getAttribute( 'id' );\r\n// }\r\n// }\r\n// }, false );\r\n// }\r\n \r\n// let wptbPanelLeft = document.getElementsByClassName( 'wptb-panel-left' );\r\n// if( wptbPanelLeft.length > 0 ) {\r\n// wptbPanelLeft[0].addEventListener( 'click', function( e ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }, false );\r\n// }\r\n \r\n// let body = document.getElementsByTagName( 'body' );\r\n// if( body.length > 0 ) {\r\n// body[0].addEventListener( 'click', function( e ) {\r\n// if ( e.target.classList.contains( 'wptb-panel-left' ) || WPTB_Helper.findAncestor( e.target, 'wptb-panel-left' ) ) {\r\n// let toolbarActiveElementId = wpcdFixedToolbar.dataset.toolbarActiveId;\r\n// document.getElementById( toolbarActiveElementId ).style.display = '';\r\n// }\r\n// }, false );\r\n// }\r\n};","var WPTB_TableStateSaveManager = function() {\n this.tableStateSet = () => {\n // get preview table\n let wptbPreviewTable = document.getElementsByClassName( 'wptb-preview-table' );\n if( wptbPreviewTable.length > 0 ) {\n wptbPreviewTable = wptbPreviewTable[0];\n \n // check if a global array doesn't exist with saved versions of the table \n // them create it\n if( ! window.wptbTableStateSaving ) {\n window.wptbTableStateSaving = [];\n } \n \n // remove the extra part of the array after changing the table \n // when it is showed in the not last modified version\n if( window.wptbTableStateSaving.length > window.wptbTableStateNumberShow + 1 ) {\n window.wptbTableStateSaving = window.wptbTableStateSaving.slice( 0, window.wptbTableStateNumberShow + 1 );\n }\n \n //add new state of table\n let wptbNewPreviewTable = wptbPreviewTable.cloneNode( true );\n let wptbHighlighted = wptbNewPreviewTable.getElementsByClassName( 'wptb-highlighted' );\n for( let i = 0; i < wptbHighlighted.length; i++ ) {\n wptbHighlighted[i].classList.remove( 'wptb-highlighted' );\n }\n let wptbDirectlyhovered = wptbNewPreviewTable.getElementsByClassName( 'wptb-directlyhovered' );\n for( let i = 0; i < wptbDirectlyhovered.length; i++ ) {\n wptbDirectlyhovered[i].classList.remove( 'wptb-directlyhovered' );\n }\n \n let cssForTdsWidthAutoValue = '';\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAuto = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAuto ) {\n cssForTdsWidthAutoValue = cssForTdsWidthAuto.innerHTML;\n }\n }\n \n let mceContentBodys = wptbNewPreviewTable.querySelectorAll( '.mce-content-body' );\n if( mceContentBodys.length > 0 ) {\n for ( let k = 0; k < mceContentBodys.length; k++ ) {\n mceContentBodys[k].classList.remove( 'mce-content-body' );\n }\n }\n\n let dataMceStyle = wptbNewPreviewTable.querySelectorAll( '[data-mce-style]' );\n if ( dataMceStyle.length > 0 ) {\n for ( let k = 0; k < dataMceStyle.length; k++ ) {\n dataMceStyle[k].removeAttribute( 'data-mce-style' );\n }\n }\n\n let mceIds = wptbNewPreviewTable.querySelectorAll( '[id^=mce_]' );\n if ( mceIds.length > 0 ) {\n for ( let k = 0; k < mceIds.length; k++ ) {\n mceIds[k].removeAttribute( 'id' );\n }\n }\n \n window.wptbTableStateSaving.push( [wptbNewPreviewTable, cssForTdsWidthAutoValue] );\n \n // set new number of state which is showed now\n window.wptbTableStateNumberShow = window.wptbTableStateSaving.length - 1;\n \n // make undo arrow active when the table was changed\n if( window.wptbTableStateSaving.length > 1 ) {\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' );\n }\n }\n \n // make redo arrow not active when the table was changed\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n \n wptbRedo.classList.add( 'wptb-undoredo-disabled' );\n }\n }\n }\n \n this.tableStateGet = ( datawptbUndoredo ) => {\n if( datawptbUndoredo && window.wptbTableStateSaving && window.wptbTableStateSaving.length > 1 ) {\n \n // changes the number of the state which displays now\n if( datawptbUndoredo == 'undo' ) {\n if( window.wptbTableStateNumberShow > 0 ) {\n window.wptbTableStateNumberShow--;\n } else {\n return false;\n }\n } else if( datawptbUndoredo == 'redo' ) {\n if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n window.wptbTableStateNumberShow++;\n } else {\n return false;\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for undo button\n let wptbUndo = document.getElementsByClassName( 'wptb-undo' );\n if( wptbUndo.length > 0 ) {\n wptbUndo = wptbUndo[0];\n }\n if( window.wptbTableStateNumberShow == 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow > 0 ) {\n if( wptbUndo ) {\n wptbUndo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n // add or delete class \"wptb-undoredo-disabled\" for redo button\n let wptbRedo = document.getElementsByClassName( 'wptb-redo' );\n if( wptbRedo.length > 0 ) {\n wptbRedo = wptbRedo[0];\n }\n if( window.wptbTableStateNumberShow == window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.add( 'wptb-undoredo-disabled' )\n }\n } else if( window.wptbTableStateNumberShow < window.wptbTableStateSaving.length - 1 ) {\n if( wptbRedo ) {\n wptbRedo.classList.remove( 'wptb-undoredo-disabled' )\n }\n }\n \n // load necessary saved table state\n let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );\n if( wptbTableSetup.length > 0 ) {\n wptbTableSetup = wptbTableSetup[0];\n\n wptbTableSetup.innerHTML = '';\n wptbTableSetup.appendChild( window.wptbTableStateSaving[window.wptbTableStateNumberShow][0] );\n\n if( window.wptbTableStateSaving[window.wptbTableStateNumberShow][1] ) {\n let cssForTdsWidthAuto = document.createElement( 'style' );\n cssForTdsWidthAuto.setAttribute( 'data-wptb-td-auto-width', true );\n cssForTdsWidthAuto.innerHTML = window.wptbTableStateSaving[window.wptbTableStateNumberShow][1];\n let head = document.head;\n if( head ) {\n let cssForTdsWidthAutoOld = head.querySelector( 'style[data-wptb-td-auto-width=\"true\"]' );\n if( cssForTdsWidthAutoOld ) {\n head.removeChild( cssForTdsWidthAutoOld );\n }\n head.appendChild( cssForTdsWidthAuto );\n }\n }\n\n WPTB_Helper.settingsPanelClear();\n WPTB_Helper.elementOptionsPanelClear();\n WPTB_LeftPanel();\n\n let wptbLeftScrollPanelCellSetting = document.getElementById( 'wptb-left-scroll-panel-cell-settings' ); \n if( wptbLeftScrollPanelCellSetting ) {\n wptbLeftScrollPanelCellSetting.classList.remove( 'visible' );\n }\n }\n }\n }\n}","var WPTB_Text = function ( text , DOMElementProt ) {\r\n let DOMElement = document.createElement('div'),\r\n elText2 = document.createElement('div'),\r\n elP = document.createElement('p'),\r\n kindIndexProt = undefined,\r\n copy = false;\r\n \r\n DOMElement.classList.add( 'wptb-text-container' );\r\n\r\n elP.innerHTML = text != undefined ? text : 'Text';\r\n elText2.appendChild(elP);\r\n DOMElement.appendChild(elText2);\r\n if ( DOMElementProt ) {\r\n let wptbElementMutch = DOMElementProt.className.match( /wptb-element-((.+-)\\d+)/i );\r\n if ( wptbElementMutch && Array.isArray( wptbElementMutch ) ) {\r\n kindIndexProt = wptbElementMutch[1];\r\n copy = true;\r\n };\r\n\r\n let attributes = [...DOMElementProt.attributes];\r\n for( let i = 0; i < attributes.length; i++ ) {\r\n DOMElement.setAttribute(attributes[i].name, attributes[i].value);\r\n }\r\n } \r\n\r\n this.kind = 'text';\r\n this.getDOMElement = function () {\r\n return DOMElement;\r\n };\r\n applyGenericItemSettings( this, kindIndexProt, copy );\r\n\r\n return this;\r\n};"]}
|
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;AAC9CG,gBAAQG,SAASC,OAAT,CAAiBC,SAAjB,CAA4BV,QAAQW,IAApC,CAAR;AACA,YAAIC,eAAeJ,SAASK,sBAAT,CAAiC,iBAAjC,CAAnB;AACA,YAAIC,oBAAoB,EAAxB;AACA,aAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIH,aAAaI,MAAjC,EAAyCD,GAAzC,EAA+C;AAC3C,gBAAIE,QAAQ,IAAIC,MAAJ,CAAY,kBAAkBlB,QAAQW,IAA1B,GAAiC,SAA7C,EAAwD,GAAxD,CAAZ;AACA,gBAAIQ,SAASP,aAAaG,CAAb,EAAgBK,SAAhB,CAA0BC,KAA1B,CAAiCJ,KAAjC,CAAb;AACA,gBAAIE,MAAJ,EAAa;AACTL,kCAAkBQ,IAAlB,CAAwBH,OAAO,CAAP,CAAxB;AACH;AACJ;AACD,YAAIL,kBAAkBE,MAAlB,GAA2B,CAA/B,EAAmC;AAC/B,gBAAIO,kBAAkBC,KAAKC,GAA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B,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};"]}
|
inc/admin/js/core/WPTB_DropHandle.js
CHANGED
@@ -64,6 +64,7 @@ var WPTB_DropHandle = function (thisElem, e) {
|
|
64 |
element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];
|
65 |
element.classList.remove( 'wptb-moving-mode' );
|
66 |
element.classList.remove( 'wptb-moving-into-same-elem' );
|
|
|
67 |
}
|
68 |
|
69 |
let td;
|
@@ -95,10 +96,11 @@ var WPTB_DropHandle = function (thisElem, e) {
|
|
95 |
wptbDropBorderMarker.style.display = 'none';
|
96 |
|
97 |
WPTB_innerElementSet(element);
|
98 |
-
|
99 |
-
if( ! element.classList.contains( 'wptb-image-container' ) ) {
|
100 |
let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
101 |
wptbTableStateSaveManager.tableStateSet();
|
|
|
102 |
}
|
103 |
}
|
104 |
let wptbContainer = document.querySelector( '.wptb-container' );
|
@@ -163,7 +165,7 @@ var WPTB_DropHandle = function (thisElem, e) {
|
|
163 |
if( thisElem.nodeName.toLowerCase() != 'td' ) {
|
164 |
let y = e.offsetY==undefined?e.layerY:e.offsetY;
|
165 |
top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );
|
166 |
-
wptbDropHandle.dataset.text = '
|
167 |
if ( y > height/2 ) {
|
168 |
top = parseFloat( coordinatesElement.top ) + height - 1;
|
169 |
wptbDropHandle.dataset.text = 'Below Element';
|
64 |
element = document.getElementsByClassName( e.dataTransfer.getData('node') )[0];
|
65 |
element.classList.remove( 'wptb-moving-mode' );
|
66 |
element.classList.remove( 'wptb-moving-into-same-elem' );
|
67 |
+
element.wptbMovingMode = 1;
|
68 |
}
|
69 |
|
70 |
let td;
|
96 |
wptbDropBorderMarker.style.display = 'none';
|
97 |
|
98 |
WPTB_innerElementSet(element);
|
99 |
+
console.log(element);
|
100 |
+
if( ! element.classList.contains( 'wptb-image-container' ) || element.wptbMovingMode == 1 ) {
|
101 |
let wptbTableStateSaveManager = new WPTB_TableStateSaveManager();
|
102 |
wptbTableStateSaveManager.tableStateSet();
|
103 |
+
element.wptbMovingMode == undefined;
|
104 |
}
|
105 |
}
|
106 |
let wptbContainer = document.querySelector( '.wptb-container' );
|
165 |
if( thisElem.nodeName.toLowerCase() != 'td' ) {
|
166 |
let y = e.offsetY==undefined?e.layerY:e.offsetY;
|
167 |
top = parseFloat( coordinatesElement.top ) - parseFloat( 11 );
|
168 |
+
wptbDropHandle.dataset.text = 'Above Element';
|
169 |
if ( y > height/2 ) {
|
170 |
top = parseFloat( coordinatesElement.top ) + height - 1;
|
171 |
wptbDropHandle.dataset.text = 'Below Element';
|
inc/admin/js/core/WPTB_Settings.js
CHANGED
@@ -65,6 +65,16 @@ var WPTB_Settings = function () {
|
|
65 |
}
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {
|
69 |
shortcodePopupWindow.classList.remove( 'wptb-popup-show' );
|
70 |
}
|
@@ -79,7 +89,11 @@ var WPTB_Settings = function () {
|
|
79 |
}
|
80 |
}
|
81 |
|
82 |
-
document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function () {
|
|
|
|
|
|
|
|
|
83 |
let bar = document.querySelector( '.wptb-edit-bar' );
|
84 |
if ( bar && bar.classList.contains( 'visible' ) ) {
|
85 |
let table = document.getElementsByClassName( 'wptb-preview-table' )[0];
|
@@ -145,6 +159,13 @@ var WPTB_Settings = function () {
|
|
145 |
|
146 |
} else if( data[0] == 'edited' ) {
|
147 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
} else {
|
149 |
messagingArea.innerHTML = '<div class="wptb-error wptb-message">Safety problems</div>';
|
150 |
}
|
65 |
}
|
66 |
}
|
67 |
|
68 |
+
window.onbeforeunload = function(e) {
|
69 |
+
let wptbSaveDisabled = document.getElementsByClassName( 'wptb-save-disabled' );
|
70 |
+
if( wptbSaveDisabled.length == 0 ) {
|
71 |
+
return true;
|
72 |
+
} else {
|
73 |
+
return null;
|
74 |
+
}
|
75 |
+
};
|
76 |
+
|
77 |
+
|
78 |
document.getElementsByClassName( 'wptb-popup-dark-area' )[0].onclick = function () {
|
79 |
shortcodePopupWindow.classList.remove( 'wptb-popup-show' );
|
80 |
}
|
89 |
}
|
90 |
}
|
91 |
|
92 |
+
document.getElementsByClassName( 'wptb-save-btn' )[0].onclick = function ( event ) {
|
93 |
+
if( ( ! event.target.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) ||
|
94 |
+
window.wptbTableStateNumberShow == event.target.dataset.wptbTableStateNumberSave ) {
|
95 |
+
return;
|
96 |
+
}
|
97 |
let bar = document.querySelector( '.wptb-edit-bar' );
|
98 |
if ( bar && bar.classList.contains( 'visible' ) ) {
|
99 |
let table = document.getElementsByClassName( 'wptb-preview-table' )[0];
|
159 |
|
160 |
} else if( data[0] == 'edited' ) {
|
161 |
messagingArea.innerHTML = '<div class="wptb-success wptb-message">Table "' + t + '" was successfully updated.</div>';
|
162 |
+
event.target.dataset.wptbTableStateNumberSave = window.wptbTableStateNumberShow;
|
163 |
+
|
164 |
+
let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );
|
165 |
+
if( wptbSaveBtn.length > 0 ) {
|
166 |
+
wptbSaveBtn = wptbSaveBtn[0];
|
167 |
+
wptbSaveBtn.classList.add( 'wptb-save-disabled' );
|
168 |
+
}
|
169 |
} else {
|
170 |
messagingArea.innerHTML = '<div class="wptb-error wptb-message">Safety problems</div>';
|
171 |
}
|
inc/admin/js/core/WPTB_TableStateSaveManager.js
CHANGED
@@ -80,6 +80,17 @@ var WPTB_TableStateSaveManager = function() {
|
|
80 |
|
81 |
wptbRedo.classList.add( 'wptb-undoredo-disabled' );
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
84 |
}
|
85 |
|
@@ -131,6 +142,17 @@ var WPTB_TableStateSaveManager = function() {
|
|
131 |
}
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
// load necessary saved table state
|
135 |
let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );
|
136 |
if( wptbTableSetup.length > 0 ) {
|
80 |
|
81 |
wptbRedo.classList.add( 'wptb-undoredo-disabled' );
|
82 |
}
|
83 |
+
|
84 |
+
let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );
|
85 |
+
if( wptbSaveBtn.length > 0 ) {
|
86 |
+
wptbSaveBtn = wptbSaveBtn[0];
|
87 |
+
if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) ||
|
88 |
+
window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {
|
89 |
+
wptbSaveBtn.classList.add( 'wptb-save-disabled' );
|
90 |
+
} else {
|
91 |
+
wptbSaveBtn.classList.remove( 'wptb-save-disabled' );
|
92 |
+
}
|
93 |
+
}
|
94 |
}
|
95 |
}
|
96 |
|
142 |
}
|
143 |
}
|
144 |
|
145 |
+
let wptbSaveBtn = document.getElementsByClassName( 'wptb-save-btn' );
|
146 |
+
if( wptbSaveBtn.length > 0 ) {
|
147 |
+
wptbSaveBtn = wptbSaveBtn[0];
|
148 |
+
if( ( ! wptbSaveBtn.dataset.wptbTableStateNumberSave && window.wptbTableStateNumberShow == 0 ) ||
|
149 |
+
window.wptbTableStateNumberShow == wptbSaveBtn.dataset.wptbTableStateNumberSave ) {
|
150 |
+
wptbSaveBtn.classList.add( 'wptb-save-disabled' );
|
151 |
+
} else {
|
152 |
+
wptbSaveBtn.classList.remove( 'wptb-save-disabled' );
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
// load necessary saved table state
|
157 |
let wptbTableSetup = document.getElementsByClassName( 'wptb-table-setup' );
|
158 |
if( wptbTableSetup.length > 0 ) {
|
inc/admin/views/builder/wptb-builder-header.php
CHANGED
@@ -85,7 +85,7 @@
|
|
85 |
</a>
|
86 |
</div>
|
87 |
<div class="wptb-save">
|
88 |
-
<a href="#" class="wptb-save-btn">
|
89 |
<?php esc_html_e( 'Save Table', 'wp-table-builder' ); ?>
|
90 |
</a>
|
91 |
</div>
|
85 |
</a>
|
86 |
</div>
|
87 |
<div class="wptb-save">
|
88 |
+
<a href="#" class="wptb-save-btn wptb-save-disabled">
|
89 |
<?php esc_html_e( 'Save Table', 'wp-table-builder' ); ?>
|
90 |
</a>
|
91 |
</div>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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
|
@@ -59,6 +59,11 @@ That's it. You're done!
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
|
|
62 |
= 1.0.5 =
|
63 |
|
64 |
* NEW: Undo/Redo options for the builder.
|
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.6
|
7 |
Requires PHP: 5.6
|
8 |
License: GPL3+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
59 |
|
60 |
== Changelog ==
|
61 |
|
62 |
+
= 1.0.6 =
|
63 |
+
|
64 |
+
* FIX: Image Element not being added between Text and List element.
|
65 |
+
* FIX: Accidental Closing of the editor. Gives warning before closing.
|
66 |
+
|
67 |
= 1.0.5 =
|
68 |
|
69 |
* NEW: Undo/Redo options for the builder.
|
wp-table-builder.php
CHANGED
@@ -15,7 +15,7 @@
|
|
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: Imtiaz Rayhan
|
20 |
* Author URI: https://imtiazrayhan.com//
|
21 |
* License: GPL-3.0+
|
@@ -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.6
|
19 |
* Author: Imtiaz Rayhan
|
20 |
* Author URI: https://imtiazrayhan.com//
|
21 |
* License: GPL-3.0+
|
39 |
|
40 |
define( NS . 'WP_TABLE_BUILDER', 'wp-table-builder' );
|
41 |
|
42 |
+
define( NS . 'PLUGIN_VERSION', '1.0.6' );
|
43 |
|
44 |
define( NS . 'WP_TABLE_BUILDER_DIR', plugin_dir_path( __FILE__ ) );
|
45 |
|