Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready(function($) {
- $(".e").mouseover(function() {
- $(this).hide();
- $(this).html($(this).html()+", contato: papadopolis_@live.com");
- $(this).attr("style","color:black");
- $(this).fadeIn('fast');
- })
- $(".d").mouseover(function() {
- $(this).hide();
- $(this).attr("style","color:black");
- $(this).fadeIn('fast');
- })
- $(".e").mouseout(function() {
- $(this).html($(this).html().match(/(.*?)\,/)[1]);
- $(this).attr("style","color:#ddd");
- $(this).fadeIn('fast');
- })
- $(".d").mouseout(function() {
- $(this).hide();
- $(this).attr("style","color:#ddd");
- $(this).fadeIn('fast');
- })
- $("form").submit(function() {
- form = {dados:""};
- $("#"+this.id+" :input").each(function() {
- form.dados += this.name+"="+this.value+"&";
- });
- form.dados = form.dados.substr(0,form.dados.length-1);
- form.type = $(this).attr("method");
- form.action = $(this).attr("action");
- form.id = this.id;
- if(form.action == "" || form.action == null)
- form.action = window.location.href.match(/((.*?\x3F|.*))/i)[2];
- if(form.type == "" || form.type == null)
- form.type = "POST";
- //alert([form.dados,form.action,form.type]); //DEBUG
- form.load = false;
- $.ajax({
- type: form.type,
- url: form.action,
- data: form.dados,
- beforeSend: function() {
- if($("#"+form.id+" #floatLoad").val("1")) {
- $("#"+form.id+" #load").html("processando formulário...");
- $("#"+form.id+" #load").show('fast');
- } else {
- if($("#"+form.id+" #ajaxCarregar").is(":hidden")) {
- $("#"+form.id+" #ajaxCarregar").show('fast')
- form.load = true
- }
- }
- $("#"+form.id+" #ajaxCarregar").attr("class","ajaxCarregar");
- },
- success: function(data) {
- if(data[0] == '\x7B') {
- eval("r = "+data);
- switch(r.status) {
- case 1:
- if(r.target!==undefined) {
- $("#"+r.target).fadeOut('fast');
- $("#"+r.target).html(r.html);
- $("#"+r.target).fadeIn('fast');
- }
- if(r.mensagem!==undefined)
- alert(r.mensagem);
- if(r.redirect!==undefined)
- window.location.href = r.redirect;
- if(r.some!==undefined)
- $("#"+form.id).fadeOut('fast');
- if(r.script !== undefined)
- eval(r.script);
- break;
- default:
- f = "Ocorreu algum erro ao enviar o formulário.\n\n";
- alert(f+r.mensagem);
- return 1;
- }
- } else
- return 0;
- },
- complete: function() {
- if(form.load == true) {
- $("#"+form.id+" #ajaxCarregar").fadeOut('fast');
- $("#"+form.id+" #load").fadeOut('fast');
- } else
- $("#"+form.id+" #ajaxCarregar").attr("class","subs");
- },
- error: function(){alert("[FORMULÁRIO]\n\nOcorreu algum erro ao processar o formulário, tente novamente.")},
- timeout: function(){alert("[FORMULÁRIO]\n\nO servidor demorou muito para responder, tente novamente.")},
- });
- return false;
- });
- f=1;
- $("form[id*=ajaxForm]").each(function() {
- $(this).attr("id",this.id+f);
- f++;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement