1$(document).ready(function() { 2 // Zebrado de tabela de produtos 3 $('table#tab-produtos > tbody > tr:odd').addClass('destaque'); 4 // Atualizar quantidade de produtos por AJAX 5 $(".campoqtd").change(function(e) { AtualizarOrcamento(); }); 6 7 $(".subtrair a").click(function(e) { 8 campo = $(this).closest(".tab-linha").find(".campoqtd"); 9 campoqtd = parseInt(0+campo.val(),10); 10 campoqtd--; 11 if ( campoqtd < 1 ) 12 campoqtd = 1; 13 campo.val(campoqtd); 14 AtualizarOrcamento(); 15 }); 16 $(".adicionar a").click(function(e) { 17 campo = $(this).closest(".tab-linha").find(".campoqtd"); 18 campoqtd = parseInt(0+campo.val(),10); 19 campoqtd++; 20 campo.val(campoqtd); 21 AtualizarOrcamento(); 22 }); 23}); 24 25function AjxOrcamento(codigo) { 26 var url = $("#siteurl").first().val() + "orcamento/ajx-orcamento-add.asp"; 27 var send = "cod="+codigo; 28 var destino = "ajx-orcamento"; 29 var destinojanela = 1; 30 var loadshow = 1; 31 var loadjanela = 1; 32 var loaddestino = ""; 33 var loadcontent = ""; 34 var wdclose = 1; 35 var scriptexec = 1; 36 var scriptdet = ""; 37 LoadAjax("get",url,send,destino,destinojanela,loadshow,loadjanela,loaddestino,loadcontent,wdclose,scriptexec,scriptdet); 38 cart = $("#ajx-orcamento"); 39 source = $("#img-"+codigo); 40 clone = $("#img-"+codigo).clone().addClass("floater"); 41 clone.offset({top:source.offset().top,left:source.offset().left }).css({'opacity':'0.7','position':'absolute','height': source.height(),'width': source.width(),'z-index': '99999'}).appendTo($('body')).animate({'top':cart.offset().top + 15,'left':cart.offset().left + 10,'width':source.width()*0.1,'height':source.height()*0.1},600,'swing',function() { $(this).remove(); }); 42 $('html,body').animate({ scrollTop: 0 }, 'fast'); 43} 44 45function AtualizarOrcamento() { 46 orcparam = ""; 47 orctotal = 0; 48 valortotal = 0; 49 semvalor = false; 50 $(".campoqtd").each(function(index, element) { 51 if ( $(this).val() == "" || $(this).val() == "0" ) 52 $(this).val(1); 53 if ( orcparam != "" ) 54 orcparam = orcparam + "&"; 55 orcparam = orcparam + $(this).attr("id") + "=" +$(this).val(); 56 orctotal += parseInt($(this).val()); 57 valortmp = $(this).parent().find(".campoval").val(); 58 if ( valortmp > 0 ) { 59 valorqtd = parseFloat(valortmp) * parseInt($(this).val()); 60 valortotal += valorqtd; 61 $(this).closest(".tab-linha").find(".valortotal").html("R$ "+FormataMoeda(valorqtd)); 62 } 63 else 64 semvalor = true 65 }); 66 if ( valortotal > 0 ) { 67 if ( !semvalor ) 68 $("#tab-total").find(".valor").html("R$ "+FormataMoeda(valortotal)); 69 else 70 $("#tab-total").find(".valor").html("R$ "+FormataMoeda(valortotal)+" *"); 71 } 72 if ( orcparam != "" ) { 73 orcparam = "?" + orcparam; 74 if ( orctotal < 10 ) 75 orctotal = "0" + orctotal; 76 $("#link-orcamento strong").html(orctotal); 77 $.ajax({url: "orcamento-upd.asp"+orcparam}).done(function( data ) { 78 if ( $("#link-orcamento strong").html() == "00" ) 79 location.reload(); 80 }); 81 } 82} 83 84function FormataMoeda(amount) 85{ 86 var i = parseFloat(amount); 87 if(isNaN(i)) { i = 0.00; } 88 var minus = ''; 89 if(i < 0) { minus = '-'; } 90 i = Math.abs(i); 91 i = parseInt((i + .005) * 100); 92 i = i / 100; 93 s = new String(i); 94 if(s.indexOf(',') < 0) { s += '.00'; } 95 if(s.indexOf(',') == (s.length - 2)) { s += '0'; } 96 s = minus + s; 97 amount = s; 98 var delimiter = "."; 99 var a = amount.split('.',2) 100 var d = a[1]; 101 var i = parseInt(a[0]); 102 if(isNaN(i)) { return ''; } 103 var minus = ''; 104 if(i < 0) { minus = '-'; } 105 i = Math.abs(i); 106 var n = new String(i); 107 var a = []; 108 while(n.length > 3) 109 { 110 var nn = n.substr(n.length-3); 111 a.unshift(nn); 112 n = n.substr(0,n.length-3); 113 } 114 if(n.length > 0) { a.unshift(n); } 115 n = a.join(delimiter); 116 if(d.length == 1) { d = d+"0"; } 117 if(d.length < 1) { amount = n; } 118 else { amount = n + ',' + d; } 119 amount = minus + amount; 120 return amount; 121} 122 123function VEmail( strEmail ) { 124 var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 125 return (filter.test(strEmail)); 126} 127 128function trimToDigits(string) { 129 s = ""; 130 var Numeros = /\d/; 131 for (i = 0; i <= string.length; i++) 132 if (Numeros.test(string.substr(i,1))) s += string.substr(i,1); 133 return s; 134} 135 136function VData(data) { 137 data = trimToDigits(data); 138 if (data.length < 8) return false; 139 dia = data.substr(0,2); 140 mes = data.substr(2,2); 141 ano = data.substr(4,4); 142 143 if(ano >= 0 && ano < 1900) return false; 144 if(ano > 2100 || ano < 0 || mes > 12 || mes < 1) return false; 145 numero = ((parseInt(ano) - 1884) / 4) 146 dias = (numero == Math.floor(numero)) ? "312931303130313130313031" : "312831303130313130313031"; 147 diamax = parseInt(dias.substring((mes - 1) * 2, ((mes - 1) * 2) + 2)); 148 if(dia < 1 || dia > diamax) return false; 149 150 return true; 151} 152 153var idfoco = ""; 154function VOrcamento() { 155 idfoco = ""; 156 CampoCheck("nome",( $("#nome").val() == "" ),"informe seu nome"); 157 CampoCheck("email",( !VEmail( $("#email").val() ) ),"e-mail inválido"); 158 CampoCheck("fone",( $("#fone").val() == "" ),"informe seu telefone"); 159 if ( idfoco != "" ) 160 return false; 161 return true; 162} 163 164function ajaxInit(){var e;try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new XMLHttpRequest}catch(t){alert("Esse browser não tem recursos para uso do Ajax"),e=null}}}return e}function LoadAjax(e,t,n,o,r,a,c,d,s,u,i,m){var l=ajaxInit();l&&("post"==e?(l.open("POST",t,!0),l.setRequestHeader("Content-Type","application/x-www-form-urlencoded")):l.open("GET",t+"?rnd="+Math.random()+"&"+n,!0),l.onreadystatechange=function(){if(1==l.readyState&&2==a&&(1==c?document.getElementById(d).innerHTML=s:opener.document.getElementById(d).innerHTML=s),4==l.readyState&&200==l.status){var e=l.responseText;e=e.replace(/\+/g," "),e=unescape(e),2==a&&(1==c?document.getElementById(d).innerHTML="":opener.document.getElementById(d).innerHTML=""),1==r?document.getElementById(o).innerHTML=e:(opener.document.getElementById(o).innerHTML=e,2==u&&setTimeout("window.close()",1)),2==i&&setTimeout(m,1)}},"post"==e?l.send(n):l.send(null))}
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.