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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-catalog-1.1.js

Код файла
Версия от 04.12.2026, 04:03:55 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
7801		for (var j = 0; j < optsValsBeforeChangedArr.length; j++) {7802			var name = optsValsBeforeChangedArr[j].name;7803			var id = optsValsBeforeChangedArr[j].id;7804			var val = t_store_product_getCurEditionOptValById(el_product, id);7805 7806			curEdition[name] = (curEdition[name] || '')7807				.replace(/&#92;/g, '\\')7808				.replace(/&gt;/g, '>')7809				.replace(/&lt;/g, '<');7810 7811			if (curVal && j === optsValsBeforeChangedArr.length - 1) {7812
История файла и сравнение версий
  • 04.12.2026, 04:03:55 · 56c3b845
val = curVal;
7813 }
7814
7815 if (curEdition[name] !== val) {
7816 doesContainSelectedOpts = false;
7817 break;
7818 }
7819 }
7820
7821 if (doesContainSelectedOpts) {
7822 if (parseInt(curEdition.quantity, 10) !== 0) {
7823 return curEdition;
7824 } else if (!firstAvailable) {
7825 firstAvailable = curEdition;
7826 }
7827 }
7828 }
7829
7830 if (firstAvailable) {
7831 // Блок "подписаться" - Выходим если не надо выключать опции
7832 var outOfStockBlock = document.querySelector('.t1122');
7833 if (outOfStockBlock) return firstAvailable;
7834
7835 if (parseInt(firstAvailable.quantity, 10) === 0) {
7836 firstAvailable = '';
7837 }
7838 }
7839
7840 return firstAvailable;
7841}
7842
7843function t_store_product_getCurEditionOptValById(el_product, id) {
7844 var el_optionsWrap = el_product.querySelector('.js-product-edition-option[data-edition-option-id="' + id + '"]');
7845 if (el_optionsWrap) {
7846 return el_optionsWrap.querySelector('.js-product-edition-option-variants').value;
7847 } else {
7848 return '';
7849 }
7850}
7851
7852function t_store_product_getEditionOptionsArr_getValues(prop, editions) {
7853 var values = [];
7854
7855 // iterate all editions and collect unique property values
7856 editions.forEach(function (curEdition) {
7857 var val = curEdition[prop];
7858 if (val !== undefined && values.indexOf(val) === -1) {
7859 values.push(val);
7860 }
7861 });
7862
7863 values = t_store_product_sortValues(values);
7864
7865 return values;
7866}
7867
7868/**
7869 * Sorts an array of values based on a specific order.
7870 *
7871 * @param {Array} result - An array of values to sort.
7872 * @param {string} type - The type of the values in the array. Can be either 'filter' or 'product'.
7873 * @param {Array} order - An array of strings representing the order to sort the values by.
7874 * @return {Array} The sorted array of values.
7875 */
7876function t_store_product_sortValuesByOrder(result, type, order) {
7877 return result.sort(function (a, b) {
7878 var valueA = type === 'filter' ? a.value : a;
7879 var valueB = type === 'filter' ? b.value : b;
7880
7881 valueA = valueA.toString().toUpperCase();
7882 valueB = valueB.toString().toUpperCase();
7883
7884 return order.indexOf(valueA) - order.indexOf(valueB);
7885 });
7886}
7887
7888/**
7889 * Tests if the values in an array are in a specific order.
7890 *
7891 * @param {Array} values - An array of values to test. Each value can be a string or an object with a `value` property.
7892 * @param {Array} order - An array of strings representing the expected order of the values.
7893 * @return {boolean} `true` if the values are in the specified order, `false` otherwise.
7894 */
7895function t_store_product_isSimpleOrderValid(values, order) {
7896 return values.every(function (current) {
7897 var value = current;
7898 // value может быть объектом с полем value
7899 if (typeof value === 'object' && typeof value.value === 'string') {
7900 value = value.value;
Предыдущие 100 строкСледующие 100 строк