1document.addEventListener('DOMContentLoaded', function () { 2 3 const boton = document.getElementById('submit_button'); 4 if (!boton) return; //bloquea el js si no existe un boton con el id 5 6 const form = boton.closest('form'); 7 if (!form) return; //bloque el js si no existe un formulario 8 9 const max_chars = 3000; 10 11 // Datepicker 12 if (window.$ && $('#fecha').length) { 13 $('#fecha').datepicker({ 14 dateFormat: 'dd/mm/yy', 15 changeYear: true 16 }); 17} 18 19 // TinyMCE 20 if (window.tinymce && document.getElementById('editorTiny')) { 21 tinymce.init({ 22 selector: '#editorTiny', 23 plugins: 'anchor autolink charmap codesample emoticons link lists media searchreplace table visualblocks wordcount image code autoresize', 24 toolbar: 'undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | link image media table | align lineheight | numlist bullist indent outdent | emoticons charmap | removeformat | code', 25 language: 'es', 26 setup: function (editor) { 27 editor.on('NodeChange', function (e) { 28 if (e.element.nodeName.toLowerCase() === 'img') { 29 e.element.classList.add('img-fluid'); 30 } 31 }); 32 } 33 }); 34 } 35 36 form.addEventListener('submit', function (e) { 37 38 // Evita doble submit 39 if (boton.disabled) { 40 e.preventDefault(); 41 return; 42 } 43 44 // Validación TinyMCE 45 if (window.tinymce && tinymce.get('editorTiny')) { 46 tinymce.triggerSave(); 47 48 const contenido = tinymce 49 .get('editorTiny') 50 .getContent({ format: 'text' }); 51 52 if (contenido.length > max_chars) { 53 alert(`Solo se admiten ${max_chars} caracteres en la sinopsis.`); 54 e.preventDefault(); // cancela envÃo 55 return; 56 } 57 } 58 59 // Bloqueo SOLO cuando el envÃo es válido 60 boton.disabled = true; 61 boton.innerText = 'Enviando...'; 62 }); 63 64});
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.