html += '</tr>'; } html += '</' + tag + '>'; function createBtnDefault(item, targetAttr) { return `<div class="t431__btnwrapper"> <a href="${item.myHref}" ${targetAttr} class="t-btn t-btn_sm"> <table style="width:100%; height:100%"> <tr> <td>${item.myText}</td> </tr> </table> </a> </div>`; } function createBtnFromTemplate(btnTemplate, item, targetAttr) { const btnContainer = document.createElement('div'); const btnElement = btnTemplate.content.cloneNode(true); const btn = btnElement.querySelector('.t-btn, .t-btntext'); const btnText = btnElement.querySelector('.t-btnflex__text, .t-btntext__text'); if (btnText) btnText.textContent = item.myText; if (btn) { btn.href = item.myHref; if (targetAttr) btn.setAttribute('target', '_blank'); btnContainer.appendChild(btn); } return btnContainer.innerHTML; } return html;}function t431_parseData(data) { if (data !== '' && typeof data != 'undefined') { data = t431__addBrTag(data); var arrayTable = []; var arrayRow = []; var currentItem = { myText: '', myHref: '', myHrefType: '', }; var hasLink = ''; var hasLinkWithSpace = ''; var hasButton = ''; var hasButtonWithSpace = ''; var endLine = ''; for (var i = 0; i < data.length; i++) { /*col end and check of special symbols: «>», «<», «&» and « »*/ if ( data[i] == ';' && !( data.slice(i - 4, i) == '<' || data.slice(i - 4, i) == '>' || data.slice(i - 5, i) == '&' || data.slice(i - 6, i) == ' ' ) ) { arrayRow.push(currentItem); currentItem = { myText: '', myHref: '', }; hasLink = ''; hasLinkWithSpace = ''; hasButton = ''; hasButtonWithSpace = ''; } else { if ( hasLink == 'link=' || hasLinkWithSpace == ' link=' || hasButton == 'button=' || hasButtonWithSpace == ' button=' ) { if (currentItem.myHref === '' && hasLink === 'link=') { currentItem.myText = currentItem.myText.slice(0, -5); currentItem.myHrefType = 'link'; } else if (currentItem.myHref === '' && hasLinkWithSpace === ' link=') { currentItem.myText = currentItem.myText.slice(0, -6); currentItem.myHrefType = 'link'; } else if (currentItem.myHref === '' && hasButton === 'button=') { currentItem.myText = currentItem.myText.slice(0, -7); currentItem.myHrefType = 'btn';