Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-t431-table-1.0.js

Код файла
Версия от 18.08.2026, 07:00:17 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
101	return result;102}103 104function t431__findMaxRowLengInArray(currentArray) {105	var maxLength = 0;106	for (var i = 0; i < currentArray.length; i++) {107		if (currentArray[i].length > maxLength) {108			maxLength = currentArray[i].length;109		}110	}111	return maxLength;112}113
История файла и сравнение версий
  • 18.08.2026, 07:00:17 · 56c3b845
114function t431__setColumnsWidth(colWidth, colsNumber, recId) {
115 if (colWidth) {
116 return colWidth[0];
117 } else {
118 var tableWidth = document.querySelector('#rec' + recId + ' .t431 .t-container .t-col');
119 var computedWidth = parseFloat(getComputedStyle(tableWidth, null).width.replace('px', ''));
120 return computedWidth / colsNumber + 'px';
121 }
122}
123
124function t431__generateTable(arrayValues, colTag, hasTargetBlank, colWidth, maxColNumber, recId) {
125 const tableWrapper = document.querySelector('#rec' + recId + ' .t431__table-wrapper');
126 const isNofollow = tableWrapper.getAttribute('data-nofollow');
127
128 let html = '';
129 let tag = '';
130
131 if (colTag == 'td') {
132 tag = 'tbody';
133 } else {
134 tag = 'thead';
135 }
136
137 html += '<' + tag + ' class="t431__' + tag + '">';
138
139 for (var i = 0; i < arrayValues.length; i++) {
140 /*add classes for striped table*/
141 if (colTag == 'td') {
142 if ((i + 1) % 2 > 0) {
143 html += '<tr class="t431__oddrow">';
144 } else {
145 html += '<tr class="t431__evenrow">';
146 }
147 } else {
148 html += '<tr>';
149 }
150 var addingCols = 0;
151 if (arrayValues[i].length < maxColNumber) {
152 addingCols = maxColNumber - arrayValues[i].length;
153 }
154 for (var j = 0; j < arrayValues[i].length + addingCols; j++) {
155 const item = arrayValues[i][j];
156 if (item) {
157 /*define col width*/
158 var currentWidth = '';
159 if (Array.isArray(colWidth) && colWidth[j]) {
160 currentWidth = colWidth[j].myText;
161 } else if (!Array.isArray(colWidth)) {
162 currentWidth = colWidth;
163 }
164 var colWithAttr = '';
165 if (colTag == 'td') {
166 colWithAttr =
167 '<td class="t431__td t-text" ' + (currentWidth ? 'width="' + currentWidth + '"' : '') + '>';
168 } else {
169 colWithAttr =
170 '<th class="t431__th t-title" ' + (currentWidth ? 'width="' + currentWidth + '"' : '') + '>';
171 }
172
173 if (item.myHref) {
174 /*define link type*/
175 var linkWithAttr = '';
176 var linkCloseTag = '';
177
178 const targetAttr = hasTargetBlank ? 'target="_blank"' : '';
179
180 if (item.myHrefType == 'link') {
181 linkWithAttr =
182 '<a href="' + item.myHref + '"' + targetAttr + (isNofollow ? ' rel="nofollow"' : '') + '>';
183 linkCloseTag = '</a>';
184
185 html += colWithAttr + linkWithAttr + item.myText + linkCloseTag + '</' + colTag + '>';
186 } else {
187 const rec = document.querySelector('#rec' + recId);
188 const btnTemplate = rec.querySelector('.t431__btn-template');
189
190 const button = btnTemplate
191 ? createBtnFromTemplate(btnTemplate, item, targetAttr)
192 : createBtnDefault(item, targetAttr);
193
194 html += colWithAttr + button + linkCloseTag + '</' + colTag + '>';
195 }
196 } else {
197 html += colWithAttr + item.myText + '</' + colTag + '>';
198 }
199 } else {
200 html +=
Предыдущие 100 строкСледующие 100 строк