PageSourceSearch

https://www.licenciasonline.com/assets/js/oScripts.js

js licenciasonline.com collected 2026-10-02 14:32:25 UTC 11,180 bytes, 275 lines download raw bytes

1// ------------------------ Configuracion inicial ---------------------------
2
3var form_mensajes={
4    enviado:"<strong>Muchas gracias.</strong> <br>Tu mensaje fue enviado con éxito. <br> En breve te responderemos.",
5    error_validacion:"Hay errores en algunos de los campos. Por favor revisa el formulario para poder continuar.",
6    error_envio:"Hubo un error al enviar el formulario. Por favor intenta mas tarde.",
7    archivo_demasiado_grande:"El archivo es demasiado grande. <br>Debe pesar menos de 2mb",
8    campo_obligatorio: "Campo obligatorio",
9    email_invalido: "Email inválido",
10    select_obligatorio: "Elija una opción"
11};
12
13var icono_loading='<svg viewBox="0 0 110 110"><circle class="st0" cx="55" cy="55" r="50"/><path class="st1" d="M92.75,22.22C83.59,11.67,70.07,5,55,5C27.39,5,5,27.39,5,55s22.39,50,50,50"/></svg>';
14var icono_popupCerrar='<svg viewBox="0 0 13 13"><line class="st0" x1="1.5" y1="11.5" x2="11.5" y2="1.5"/><line class="st0" x1="1.5" y1="1.5" x2="11.5" y2="11.5"/></svg>';
15var icono_sliderFlechaIzq='<svg viewBox="0 0 18 18" ><path d="M14.25 9H3.75" stroke="white" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/><path d="M9 14.25L3.75 9L9 3.75" stroke="white" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>';
16var icono_sliderFlechaDer='<svg viewBox="0 0 18 18" ><path d="M3.75 9L14.25 9" stroke="white" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/><path d="M9 3.75L14.25 9L9 14.25" stroke="white" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>';
17var icono_desplegable_flecha='<svg viewBox="0 0 20 20"><polyline class="st0" points="17,6.5 10,13.5 3,6.5 "/></svg>';
18var icono_desplegable_mas='<svg viewBox="0 0 20 20"><line class="st0" x1="10" y1="3" x2="10" y2="17"/><line class="st0" x1="17" y1="10" x2="3" y2="10"/></svg>';
19var icono_menuMobile='<svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="28" height="3" fill="#344248"/><rect y="9" width="28" height="3" fill="#344248"/><rect y="18" width="28" height="3" fill="#344248"/></svg>';
20
21
22
23// ------------------------ oScripts ---------------------------
24
25var timerHomeSlider=0;
26var oScriptsMouseX=0;
27var oScriptsMouseY=0;
28
29var mouseoverMenuMobile=false;
30function abrirMenuMobile() {    
31    var anchoMenu=$("#menuMobile").outerWidth();
32    
33    gsap.to( $("#menuMobile"), 0.5, {
34        x: 0,
35        ease: Power4.easeOut
36    });    
37    $("body").css("overflow","hidden");
38    $("#menuMobile").addClass("activo");
39    $(".botonMenuMobile").addClass("activo");
40}
41
42function cerrarMenuMobile() {
43    var anchoMenu=$("#menuMobile").outerWidth();    
44    gsap.to( $("#menuMobile"), 0.2, {
45        x: anchoMenu
46    });    
47    $("body").css("overflow","auto");
48    $("#menuMobile").removeClass("activo");
49    $(".botonMenuMobile").removeClass("activo");
50}
51
52
53function jAlert(texto, botonActivado, cerrarActivado, width ) {
54    if (width) {
55        $( "#jAlert .alert" ).css( "max-width", width );
56    } else {
57        $( "#jAlert .alert" ).css( "max-width", "50em" );
58    }
59    $("#jAlert .alert .botonOK").css("display","block");
60    if ( botonActivado==false ) {
61        $("#jAlert .alert .botonOK").css("display","none");
62    }
63    $("#jAlert .alert .botonCerrar").css("display","block");
64    if ( cerrarActivado==false ) {
65        $("#jAlert .alert .botonCerrar").css("display","none");
66    }
67    $( "#jAlert .alert .texto" ).html(texto);
68    $("#jAlert").css("visibility","visible");
69    $("#jAlert").css("opacity","1");
70}
71
72$(document).ready(function () {
73
74    // Loading
75    $("body").prepend('<div id="oLoading">'+icono_loading+'</div>');
76    if ( !$("body").hasClass("oLoading") ) {
77        $("#oLoading").css("display","none");
78    }
79
80
81    $("a").click(function(event){
82        if ( $(this).attr("href")=="#" ) {
83            event.preventDefault();
84        }
85    });
86
87    // Menu mobile
88    if ( $("#menuMobile").length>0 ) {
89        var contenido=$("#menuMobile").html();
90        $("#menuMobile").remove();
91        var nuevoMenu='<div id="menuMobile"><nav><div class="middle">'+contenido+'</div></nav></div>';
92        $("body").append(nuevoMenu);
93        //$("body").append('<div class="botonMenuMobile">'+icono_menuMobile+'</div>');
94
95        $(".botonMenuMobile").click(function(){        
96            if ( !$(".botonMenuMobile").hasClass("activo") ) {
97                abrirMenuMobile();
98            } else {
99                cerrarMenuMobile();
100            }            
101        });
102        $("#menuMobile, .botonMenuMobile").mouseenter(function(){
103            mouseoverMenuMobile=true;
104        });
105        $("#menuMobile, .botonMenuMobile").mouseleave(function(){
106            mouseoverMenuMobile=false;
107        });
108    }
109
110    $(document).mousedown(function(){
111        if ( !mouseoverMenuMobile ) {
112            cerrarMenuMobile();
113        }
114    });
115
116    $("#menuMobile nav a.botonSeccion").click(function(){
117        cerrarMenuMobile();
118    });
119
120
121    // jAlert
122    $( "body" ).prepend('<div id="jAlert"><div class="table"><div class="cell"><div class="overlay"></div><div class="alert"><div class="texto"></div><div class="botonOK">OK</div><div class="botonCerrar">'+icono_popupCerrar+'</div></div></div></div></div>' );
123    $("#jAlert .alert .botonOK, #jAlert .alert .botonCerrar, #jAlert .overlay").click(function(){
124        $("#jAlert").css("opacity","0");
125        $("#jAlert").css("visibility","hidden");
126    });
127
128
129});
130
131
132
133
134
135
136
137// ------------------------ oForms ---------------------------
138
139function isEmail(email) {
140    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
141    return regex.test(email);
142}
143function isEmpty(str) {
144    return str.replace(/^\s+|\s+$/g, '').length == 0;
145}
146
147function validarcampo(elemento) {
148    if ( $(elemento).prop('type')!="radio" && $(elemento).prop('type')!="button" && $(elemento).prop('type')!="checkbox" && $(elemento).prop('type')!="hidden" ) {
149
150        mensaje=$(elemento).parent().find(".mensaje");
151        
152        mensaje.css("display","none");
153        if ( !$(elemento).hasClass("opcional") ) {
154            
155            if ( $(elemento).is("input") || $(elemento).is("textarea") ) {
156                if ( isEmpty($(elemento).val()) ) {
157                    mensaje.html(form_mensajes["campo_obligatorio"]);
158                    mensaje.css("display","block");            
159                } else if ( ( $(elemento).prop('type')=="email" ) && ( !isEmail( $(elemento).val() ) ) ) {
160                    mensaje.html(form_mensajes["email_invalido"]);
161                    mensaje.css("display","block");
162                }
163            } else if ( ( $(elemento).is("select") ) && ( $(elemento).val()=="" ) ) {
164                mensaje.html(form_mensajes["select_obligatorio"])
165                mensaje.css("display","block");
166            }
167        }
168    }    
169}
170
171function setearForm(nombreForm) {
172    $(nombreForm+" input, "+nombreForm+" select, "+nombreForm+" textarea").each(function( index ) {
173        if ( $(this).prop('type')!="radio" && $(this).prop('type')!="button" && $(this).prop('type')!="checkbox" && $(this).prop('type')!="hidden" ) {
174            $(this).parent().append("<div class='mensaje'></div>");
175        }
176    });
177    
178    $(nombreForm+" .enviar").click(function(e){
179        e.preventDefault();
180        
181        $("#oLoading").css("opacity","1");
182        $("#oLoading").css("display","block");
183        
184        var validacionok=true;
185
186        $(nombreForm+" input, "+nombreForm+" select, "+nombreForm+" textarea").each(function( index ) {
187
188            if ( !$(this).hasClass("opcional") ) {
189                if ( $(this).prop('type')!="radio" && $(this).prop('type')!="button" && $(this).prop('type')!="checkbox" && $(this).prop('type')!="hidden" ) {
190                    if ( $(this).is("input") || $(this).is("textarea") ) {
191                        if ( isEmpty($(this).val()) ) {
192                            validacionok=false;
193                        } else if ( ( $(this).prop('type')=="email" ) && ( !isEmail( $(this).val() ) ) ) {
194                            validacionok=false;
195                        }
196                    } else if ( ( $(this).is("select") ) && ( $(this).val()=="" ) ) {
197                        validacionok=false;
198                    }
199                }
200
201            }
202        });        
203        if ( validacionok ) {
204
205            if ( $(nombreForm).data("ajax") ) {
206                var datos =new FormData( $(nombreForm).get(0) );
207                $.ajax( {
208                    url: $(nombreForm).attr("action"),
209                    type: 'POST',
210                    data: datos,
211                    processData: false,  // tell jQuery not to process the data
212                    contentType: false   // tell jQuery not to set contentType
213                } ).done(function( data ) {
214
215                    if ( data=="OK" ) {
216                        if ( $(nombreForm).data("mensaje") ) {
217                            jAlert($(nombreForm).data("mensaje"),true,false);
218                        } else {
219                            jAlert(form_mensajes["enviado"],true,false);
220                        }
221                        $("#oLoading").css("display","none");
222                        $(nombreForm)[0].reset();
223                    } else {
224                        jAlert(form_mensajes["error_envio"],true,false);
225                        $("#oLoading").css("display","none");
226                    }
227
228                } ).fail(function() {
229                    jAlert(form_mensajes["error_envio"],true,false);
230                    $("#oLoading").css("display","none");
231                });
232            } else {
233                $(nombreForm)[0].submit();
234                $(nombreForm)[0].reset();
235                $("#oLoading").css("display","none");
236            }
237            
238        } else {
239            $("#oLoading").css("display","none");
240            jAlert(form_mensajes["error_validacion"],true,false);
241            $(nombreForm+" input, "+nombreForm+" select, "+nombreForm+" textarea").each(function( index ) {
242                validarcampo($(this));
243            });
244            $(nombreForm+" input, "+nombreForm+" textarea").blur(function(){
245                validarcampo($(this));
246            });
247            $(nombreForm+" select").change(function(){
248                validarcampo($(this));
249            });
250        }        
251        
252                
253    });
254
255    $(nombreForm+" input[type=file]").change(function(){
256        if(this.files[0].size > form_maxFileSize*1048576 ){
257           jAlert(form_mensajes["archivo_demasiado_grande"],true,false);
258           this.value = "";
259        }
260    });
261
262}
263
264
265//$(document).ready(function () {
266
267//    $("form").each(function(index){
268//        setearForm( "form:eq("+index+")" );
269//    });
270    
271//    if ( getUrlVars()["mensaje"]=="error_form" ) {
272//        jAlert(form_mensajes["error_envio"],true,false);
273//    }
274
275//});

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.