Welcome to WordPress. This is your first post. Edit or delete it, then start writing!
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!
). */ (function() { 'use strict';const LIMITE = 35; // Seletor padrão WooCommerce: '.woocommerce-loop-product__title' // Adapte o seletor para incluir a classe do seu tema, se necessário. const SELETOR = '.titulo-card, .woocommerce-loop-product__title, .product_title';function limitarTitulo(el) { const texto = el.textContent.trim(); if (texto.length > LIMITE) { const truncado = texto.substring(0, LIMITE) + '...'; el.textContent = truncado; el.title = texto; // Adiciona o título completo como dica de ferramenta } }function processarTitulos(parentNode) { // Se o nó principal for um título, limite-o diretamente. if (parentNode.matches && parentNode.matches(SELETOR)) { limitarTitulo(parentNode); } // Limita todos os títulos filhos. parentNode.querySelectorAll(SELETOR).forEach(limitarTitulo); }// --- Configuração do MutationObserver para conteúdo dinâmico ---const observerConfig = { childList: true, subtree: true };const callback = function(mutationsList, observer) { mutationsList.forEach(mutation => { if (mutation.type === 'childList') { mutation.addedNodes.forEach(node => { // Verifica se é um elemento e não um nó de texto if (node.nodeType === 1) { // Processa todos os títulos dentro do nó recém-adicionado processarTitulos(node); } }); } }); };// 1. Executa a função imediatamente ao carregar processarTitulos(document);// 2. Inicia a observação no
Hi, this is a comment.
To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
Commenter avatars come from Gravatar.