/* Deprecado
$(document).on("DOMNodeInserted", ".ms-webpart-zone, .ms-wiki-columnSpacing", function () {
//Para los que sean de tipo btn
$("td.ms-cellstyle.ms-vb2:contains('btn')").not(".calculadoCambiado").each(function() {
var texto='
'+$(this).text()+'
';
if(texto.toLowerCase().indexOf('btn btn-')==-1)return true;
$(this).html(texto);
$(this).addClass("calculadoCambiado");
});
//Para los que tengan la clase checkCalculadoPQ
$("td.ms-cellstyle.ms-vb2:contains('checkCalculadoPQ')").not(".calculadoCambiado").each(function() {
var texto=''+$(this).text()+'
';
if(texto.toLowerCase().indexOf('checkcalculadopq')==-1)return true;
$(this).html(texto);
$(this).addClass("calculadoCambiado");
});
});
*/
// Creamos una función que contenga la lógica original
function procesarNuevosElementos() {
// Para los que sean de tipo btn
$("td.ms-cellstyle.ms-vb2:contains('btn')").not(".calculadoCambiado").each(function() {
var texto = '' + $(this).text() + '
';
if (texto.toLowerCase().indexOf('btn btn-') == -1) return true;
$(this).html(texto);
$(this).addClass("calculadoCambiado");
});
// Para los que tengan la clase checkCalculadoPQ
$("td.ms-cellstyle.ms-vb2:contains('checkCalculadoPQ')").not(".calculadoCambiado").each(function() {
var texto = '' + $(this).text() + '
';
if (texto.toLowerCase().indexOf('checkcalculadopq') == -1) return true;
$(this).html(texto);
$(this).addClass("calculadoCambiado");
});
}
// Configuramos el MutationObserver
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type === 'childList') {
procesarNuevosElementos();
}
});
});
// Configuración del observer
var config = { childList: true, subtree: true };
// Iniciamos la observación en los elementos deseados
$(".ms-webpart-zone, .ms-wiki-columnSpacing").each(function() {
observer.observe(this, config);
});
// Ejecutamos la función una vez al inicio para procesar los elementos existentes
$(document).ready(function() {
procesarNuevosElementos();
});