1var debug=false; 2$(document).ready(function() { 3 4 $(".seleccion.conmutable").inicializarConmutable(); 5 $("textarea").each(function() { 6 if ($(this).attr("maxLength")) { 7 var idcar = "contador-"+$(this).attr("id"); 8 var permitidos = $(this).attr("maxLength"); 9 10 function contar() { 11 var contenido = $(this).val(); // Guarda el contenido del textarea 12 var caracteres = contenido.length; // Cuenta los caracteres del textarea 13 if(debug){ 14 console.log("Este es el valor del textarea: " + contenido); 15 console.log("Esta es la longitud del contenido del textarea: " + caracteres); 16 } 17 if (caracteres < permitidos) { 18 19 $("#"+idcar).text(permitidos-caracteres); 20 $(this).parent("").find(".contador").removeClass("maxPermitido"); 21 } else { 22 23 $("#"+idcar).text("0"); // Pone a 0 el número de caracteres disponibles 24 $(this).parent("").find(".contador").addClass("maxPermitido"); 25 } 26 }; 27 28 $(document).ready(contar); 29 $(this).keypress(contar).keydown(contar).keyup(contar).focus(contar).blur(contar).change(contar).click(contar).select(contar); 30 $("#clean").click(contar); 31 } 32 }); 33 34}); 35(function($){ 36 $.fn.extend({ 37 inicializarConmutable: function(){ 38 if(mag_edit_Mode!=null && !mag_edit_Mode){ 39 this.each(function(){ 40 var contenedor = $(this); 41 var queryConmut = $("select"); 42 var aux= contenedor.find(queryConmut); 43 var conmutId = aux.attr('id'); 44 if(debug){ 45 console.log('opción seleccionada del conmutable:'); 46 console.log(conmutId); 47 } 48 inicializarConmutable(conmutId); 49 contenedor.find(queryConmut).change(function(event){ 50 var conmutId = $(this).attr('id'); 51 var conmutValue = $(this).val(); 52 if(debug){ 53 console.log('valor seleccionado'+conmutValue); 54 } 55 mostrarSeccion(conmutValue, conmutId) 56 }); 57 });//each 58 } 59 } 60 61 62 }); 63})(jQuery) 64 65 function inicializarConmutable(nombre){ 66 if(debug){ 67 console.log('inicializando...'+nombre); 68 } 69 var seleccionaver=$('div[id^="seccionconm-'+nombre+'"]'); 70 $('div[id^="seccionconm-'+nombre+'"]').css("display", "none"); 71 reqToReqOc('div[id^="seccionconm-'+ nombre+'"] [required]'); 72 var valorSeleccionado = $('#'+nombre).val(); 73 var verSelConmu=''; 74 if(valorSeleccionado!=""){ 75 if(debug){ 76 console.log('id del conmutable '+valorSeleccionado); 77 } 78 verSelConmu='-'+valorSeleccionado; 79 $('div[id^="seccionconm-'+ nombre + verSelConmu +'"]').css("display", "block"); 80 reqOcToReq('div[id^="'+'seccionconm-'+ nombre + verSelConmu+'"] [requiredOc]'); 81 } 82 } 83 84 function reqToReqOc(nombre){ 85 $(nombre).each(function() { 86 var $t = $(this); 87 $t.attr({ 88 requiredOc: $t.attr('required'), 89 }) 90 .removeAttr('required'); 91 }); 92 } 93 94 function reqOcToReq(nombre){ 95 $(nombre).each(function() { 96 var $t = $(this); 97 $t.attr({ 98 required: $t.attr('requiredOc'), 99 }) 100 .removeAttr('requiredOc'); 101 }); 102 } 103 104 function mostrarSeccion(valor, nombre){ 105 if(debug){ 106 console.log(valor); 107 console.log(nombre); 108 } 109 var nombreDiv=""; 110 if(nombre!=""){ 111 nombreDiv="seccionconm-"+nombre; 112 reqToReqOc('div[id^='+ nombreDiv +'] [required]'); 113 $('div[id^='+ nombreDiv +']').css("display", "none"); 114 } 115 116 if(valor!="" && nombre!=""){ 117 var valorDiv="seccionconm-"+nombre+"-"+valor; 118 $("#"+valorDiv).css("display", "block"); 119 reqOcToReq('div[id^='+valorDiv+'] [requiredOc]'); 120 } 121 }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.