1 2function ShowMessage(message, _class, flag_img, bgcolor){ 3 4 var flag_img = (typeof flag_img != 'undefined')? flag_img : false, 5 bgcolor = (typeof bgcolor != 'undefined')? bgcolor : ''; 6 7 if ($("#New-Message-Alert").length){ 8 $("#New-Message-Alert").remove(); 9 } 10 11 var div_msg = document.createElement('div'); 12 $(div_msg).attr({ "id" : "New-Message-Alert" }); 13 14 var eff_class = (typeof _class != 'undefined')? _class : "show-msg-result"; 15 16 if(flag_img ){ 17 18 $(div_msg).addClass(eff_class).append("<p>"+ message +"</p>").appendTo('body'); 19 20 }else{ 21 22 $(div_msg).addClass(eff_class).append("<img src='"+URLP+"images/delete_item.png' />").append("<p>"+ message +"</p>"); 23 24 if(bgcolor != ''){ $(div_msg).css({"background-color":bgcolor}); } 25 26 $(div_msg).appendTo('body'); 27 28 } 29 30 if(!flag_img){ 31 $("img",div_msg).click(function(){ $(this).parent().remove(); }); 32 } 33 34 $(div_msg).fadeIn().delay(5000).fadeOut("slow"); 35 36 37} 38 39(function($) { 40 $.fn.onEnter = function(func) { 41 this.bind('keypress', function(e) { 42 if (e.keyCode == 13) func.apply(this, [e]); 43 }); 44 return this; 45 }; 46 })(jQuery); 47 48 function validar_email(value){ 49 // creamos nuestra regla con expresiones regulares. 50 var filter = /[\w-\.]{3,}@([\w-]{2,}\.)*([\w-]{2,}\.)[\w-]{2,4}/; 51 // utilizamos test para comprobar si el parametro valor cumple la regla 52 if(filter.test(value)) 53 return true; 54 else 55 return false; 56 } 57 58 $(document).on("keypress", ".just_nros",function(e) { 59 60 var nav4 = window.Event ? true : false; 61 62 63 if (window.event){ 64 tecla = (document.all) ? e.keyCode : e.which; 65 if (tecla==8 || tecla==127 || tecla==9) return true; //Tecla de retroceso (para poder borrar) 66 patron = /\d/; 67 te = String.fromCharCode(tecla); 68 return patron.test(te); 69 } 70 else{ 71 var key = nav4 ? e.which : e.keyCode; 72 return (key = 48 && key <= 57); 73 } 74 75}); 76 77 function AlertModal(msg,iconClass,showlink){ 78 79 var iconclass = (typeof iconClass != 'undefined')?iconClass:'fa-check-circle-o'; 80 81 $("#modal_gral i").removeClass().addClass('fa '+iconclass+' bigico'); 82 $("#modal_gral h4").text(msg); 83 84 if(typeof showlink != 'undefined'){ 85 $("#modal_gral a").remove(); 86 } 87 88 $("#modal_gral").modal(); 89 } 90 91 92 93$(".add_product").click(function(e){ 94 e.preventDefault ? e.preventDefault() : e.returnValue = false; 95 96 var ids = ($(".allmodels").length)?$(".allmodels").val():$(this).closest(".box").find(".model_id").val(), 97 _cant = ($(".num_addp").length)?$(".num_addp").val():$(this).closest(".box").find(".num_adda").val(); 98 99 if(_cant != "" && parseInt(_cant) > 0){ 100 101 $.ajax({
102 type: 'post', 103 dataType: 'json', 104 url: URLSITE+'productos/addproduct', 105 cache: false, 106 data: {id: ids,cant: _cant}, 107 success: function(json){ 108 109 var $message = ""; 110 111 if(json.flag == "0"){ 112 113 $message = 'Se ha(n) agregado ' + json.cant + ' "' + json.row.nombre +'"'; 114 115 }else{ 116 117 $message = 'Solo existe(n) ' + json.cant + ' producto(s) del módelo "' + json.row.nombre +'" en stock!!'; 118 119 } 120 121 //ShowMessage($message + '<br><a href="'+URLSITE+'carshop">Ver Carrito</a>'); 122 AlertModal($message); 123 124 $(".num_addp").val(1); 125 $(".sbolsa span").text("Carrito ("+parseInt(json.total)+")"); 126 //$("#totalcash").text("$"+json.importe); 127 128 }, 129 error: function(xhr, textStatus, error){ 130 131 console.log(xhr.statusText+" : "+textStatus+" - "+error); 132 133 } 134 135 }); 136 137 }else{ 138 AlertModal('¡No ha espeficado cuantos productos desea!','fa-ban'); 139 //ShowMessage('¡No ha espeficado cuantos productos desea!'); 140 } 141 142}); 143 144$(".add_accesorio").click(function(e) { 145 e.preventDefault ? e.preventDefault() : e.returnValue = false; 146 147 var ids = $(this).closest(".box").find(".model_id").val(), 148 _cant = $(this).closest(".box").find(".num_adda").val(); 149 150 console.log(ids, _cant); 151 152 if(_cant != "" && parseInt(_cant) > 0){ 153 154 $.ajax({
155 type: 'post', 156 dataType: 'json', 157 url: URLSITE+'productos/addproduct', 158 cache: false, 159 data: {id: ids,cant: _cant}, 160 success: function(json){ 161 162 var $message = ""; 163 164 if(json.flag == "0"){ 165 166 $message = 'Se ha(n) agregado ' + json.cant + ' "' + json.row.nombre +'"'; 167 168 }else{ 169 170 $message = 'Solo existe(n) ' + json.cant + ' producto(s) del módelo "' + json.row.nombre +'" en stock!!'; 171 172 } 173 174 //ShowMessage($message + '<br><a href="'+URLSITE+'carshop">Ver Carrito</a>'); 175 AlertModal($message); 176 177 $(".num_addp").val(1); 178 $(".sbolsa span").text("Carrito ("+parseInt(json.total)+")"); 179 //$("#totalcash").text("$"+json.importe); 180 181 }, 182 error: function(xhr, textStatus, error){ 183 184 console.log(xhr.statusText+" : "+textStatus+" - "+error); 185 186 } 187 188 }); 189 190 }else{ 191 AlertModal('¡No ha espeficado cuantos productos desea!','fa-ban'); 192 //ShowMessage('¡No ha espeficado cuantos productos desea!'); 193 } 194 195}); 196 197function formato_currency(precio_nuevo){ 198 return '$ ' + precio_nuevo.toFixed(2).replace(/./g, function(c, i, a) { 199 return i && c !== "." && ((a.length - i) % 3 === 0) ? ',' + c : c; 200 }); 201} 202 203$(".allmodels").change(function(e){ 204 205 var ids = $(this).val(); 206 207 $.ajax({
208 type: 'post', 209 dataType: 'json', 210 url: URLSITE+'productos/getinfostock', 211 cache: false, 212 data: {id: ids}, 213 success: function(data){ 214 // console.log(data); 215 216 if(data.precio == '0.00') 217 $(".precio").css({ visibility: 'hidden'}); 218 else 219 $(".precio").css({ visibility: 'visible'}); 220 $(".price:not(.accessory)").text("$"+data.precio); 221 $(".currency span").text(data.tipo_cambio); 222 $('.btn_comprar:not(.add_accesorio)').remove(); 223 224 if(data.promocion == 1) { 225 $('.promotion:not(.primary)').removeClass('hidden'); 226 $('.price.promotion:not(.primary)').text(formato_currency(Number(data.precio_promocion))); 227 $('.primary').addClass('promotion'); 228 $('.currency.primary').addClass('hidden'); 229 } 230 else { 231 $('.promotion:not(.primary)').addClass('hidden'); 232 $('.primary').removeClass('promotion'); 233 $('.currency.primary').removeClass('hidden'); 234 } 235 236 if(data.stock == 0) { 237 $('<a>', { 238 class: 'btn_comprar', 239 html: 'SOLICITAR COTIZACION', 240 onclick: "javascript:$('.lightbox').show();$('.lightbox .mensaje').html('Hola, solicito información y costos del producto " + data.producto + " modelo " + data.nombre + "')", 241 style: 'cursor: pointer;' 242 }).insertAfter('h4.precio.content_currency'); 243 } 244 else 245 $('<a>', { 246 class: 'btn_comprar add_product', 247 html: 'COMPRAR', 248 href: '#' 249 }).insertAfter('h4.precio.content_currency'); 250 251 $(".add_product").click(function(e){ 252 e.preventDefault ? e.preventDefault() : e.returnValue = false; 253 254 var ids = ($(".allmodels").length)?$(".allmodels").val():$(this).closest(".box").find(".model_id").val(), 255 _cant = ($(".num_addp").length)?$(".num_addp").val():$(this).closest(".box").find(".num_adda").val(); 256 257 if(_cant != "" && parseInt(_cant) > 0){ 258 259 $.ajax({
260 type: 'post', 261 dataType: 'json', 262 url: URLSITE+'productos/addproduct', 263 cache: false, 264 data: {id: ids,cant: _cant}, 265 success: function(json){ 266 267 var $message = ""; 268 269 if(json.flag == "0"){ 270 271 $message = 'Se ha(n) agregado ' + json.cant + ' "' + json.row.nombre +'"'; 272 273 }else{ 274 275 $message = 'Solo existe(n) ' + json.cant + ' producto(s) del módelo "' + json.row.nombre +'" en stock!!'; 276 277 } 278 279 //ShowMessage($message + '<br><a href="'+URLSITE+'carshop">Ver Carrito</a>'); 280 AlertModal($message); 281 282 $(".num_addp").val(1); 283 $(".sbolsa span").text("Carrito ("+parseInt(json.total)+")"); 284 //$("#totalcash").text("$"+json.importe); 285 286 }, 287 error: function(xhr, textStatus, error){ 288 289 console.log(xhr.statusText+" : "+textStatus+" - "+error); 290 291 } 292 293 }); 294 295 }else{ 296 AlertModal('¡No ha espeficado cuantos productos desea!','fa-ban'); 297 //ShowMessage('¡No ha espeficado cuantos productos desea!'); 298 } 299 300 }); 301 }, 302 error: function(xhr, textStatus, error){ 303 304 console.log(xhr.statusText+" : "+textStatus+" - "+error); 305 306 } 307 308 }); 309 310});
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.