Bloqueio de double post arrumado

2 participantes

Ver o tópico anterior Ver o tópico seguinte Ir para baixo

Tópico resolvido Bloqueio de double post arrumado

Mensagem por iScroll 21.02.17 15:29

Detalhes da questão


Endereço do fórum: http://www.brasilplayultimate.forumeiros.com/forum
Versão do fórum: PunBB

Descrição


Olá Convidado no meu fórum eu tenho o JS do seguinte codigo:
https://i.imgur.com/h13T0ft.png
Ele envia a resposta rápida sem refresh (abrir outro link para clicar "Deseja ver sua mensagem ou voltar para o fórum"

Mas, ocorre o seguinte problema:
https://i.imgur.com/1VBOeX4.png Ele envia normal, certo?
Só que meu ant-duble post não ativa com esse JS.
https://i.imgur.com/PVDuhDY.png
Eu necessito dar um F5 na pagina para que ele funcione, veja:
https://i.imgur.com/zgeW6Qx.png

Gostaria também de retirar os botões "Novo tópico e Bloqueado" e deixá-los ocultos.
Seria possível fazer e resolver isso?

Ant-Dual Post:
Código:
jQuery(document).ready(function(){if(_userdata["user_id"] !== 1 || _userdata["user_id"] !== 2){var r='form';var k='#quick_reply';var t=jQuery('input[name="t"]').val();var p='/t'+t+'-';if(jQuery(k).length){var q=''}else{var q='<br><a href="'+p+'">Clique aqui</a> para voltar ao tópico.'};var s='<img src=http://2img.net/i/fa/admin/icones/big_ico/warning.png><br>É proibido fazer double post.'+q;if(jQuery('body#phpbb').length){var m='<div class=panel style=font-size:23px><span class=corners-top></span><center style=padding:5px>'+s+'</center><span class=corners-bottom></span></div>';var h='p.author'}else if(jQuery('table.bodylinewidth').length){var m='<table width=100%><tr><td align=center>'+s+'</td></tr></table>';var h='.name'}else{var m='<div class="main-content message box-content" style=text-align:center;padding:5px>'+s+'</div>';var h='.username'};if(jQuery(r+'[action="/post"]').length&&jQuery('input[name="mode"][value="reply"]').length){var g=jQuery('a.mainmenu#logout').text().split('[ ')[1].replace(/ ]/g,'');if(jQuery(k).length){jQuery.get('/post?t='+t+'&mode=reply',function(d){if(jQuery(h+':eq(0)',d).text().split(' em')[0].replace(' por ','')==g){jQuery(r+k).html(m)}})}else{if(jQuery(h+':eq(0)').text().split(' em')[0].replace(' por ','')==g){jQuery(r+'[action="/post"]').html(m)}}}}[u][/u]});


Resposta rápida sem refresh:
Código:
$(function() {
var Copyright = 'Copyright BestSkins © 2013. All right reserved. Não remova os créditos do autor.';
var daemon = $('a[href*="mode=reply"]').attr('href');
$('input[name="post"]').click(function(post){
  post.preventDefault();
  var valor = $('#text_editor_textarea').sceditor('instance').val().replace(/\s/g,'').length;
    if(valor == 0){
      alert("Seu post está vazio");
    }
    else if(10 > valor){
      alert("Você precisa digitar pelo menos mais "+(10-valor)+" caracteres");
    }
    else if(1500 < valor){
      alert("Seu post passou de 1500 caracteres, diminua-o");
    }
    else if(10 <= valor && valor<= 1500) {
      $.post(daemon,{"message":$('#text_editor_textarea').sceditor('instance').val(),"post":"Enviar","attach_sig":"1"},function(e){
      var href = $(e).find(".message a:first").attr('href');
      location.href = href;
      $.get(href,function(daemon){
          $(daemon).find(".post:last").hide().insertAfter(".post:last").slideDown(450);
      });
      $('#text_editor_textarea').sceditor('instance').val("");
    });
  }
});
});
iScroll

iScroll
Super Membro

Membro desde : 08/03/2015
Mensagens : 1701
Pontos : 2311

http://ultimatelife.forumeiros.com

Ir para o topo Ir para baixo

Principal Contribuidor

Tópico resolvido Re: Bloqueio de double post arrumado

Mensagem por Shek 26.02.17 14:36

Olá!

Troca o código da resposta rápida por este:
Código:
$(function() {
var Copyright = 'Copyright BestSkins © 2013. All right reserved. Não remova os créditos do autor.';
var daemon = $('a[href*="mode=reply"]').attr('href');
$('input[name="post"]').click(function(post){
  post.preventDefault();
  var valor = $('#text_editor_textarea').sceditor('instance').val().replace(/\s/g,'').length;
    if(valor == 0){
      alert("Seu post está vazio");
    }
    else if(10 > valor){
      alert("Você precisa digitar pelo menos mais "+(10-valor)+" caracteres");
    }
    else if(1500 < valor){
      alert("Seu post passou de 1500 caracteres, diminua-o");
    }
    else if(10 <= valor && valor<= 1500) {
      $.post(daemon,{"message":$('#text_editor_textarea').sceditor('instance').val(),"post":"Enviar","attach_sig":"1"},function(e){
      var href = $(e).find(".message a:first").attr('href');
      location.href = href;
      $.get(href,function(daemon){
          $(daemon).find(".post:last").hide().insertAfter(".post:last").slideDown(450);
      });
      $('#text_editor_textarea').sceditor('instance').val("");
    });
    $('form#quick_reply').before("<center>Você deve aguardar para postar novamente.</center>").remove();
  }
});
});
Eu fiz um teste e página atualiza sozinha... Isso é normal para este script? Se não, recomendo este tópico: https://ajuda.forumeiros.com/t74511-topic Eu acredito que esteja usando outro script além deste, então, revise quais deles quer.

Atenciosamente.
Shek

Shek
Principal Contribuidor
Principal Contribuidor

Membro desde : 11/04/2009
Mensagens : 18896
Pontos : 22793

https://shiftactive.blogspot.com/ https://www.facebook.com/ShiftActif https://twitter.com/ShiftActif

Ir para o topo Ir para baixo

Tópico resolvido Re: Bloqueio de double post arrumado

Mensagem por iScroll 26.02.17 19:10

Olá esse resultou, mas esqueci que o código que uso é esse:

Código:
//By doannamthai-getover || forumotion-forumvi ;
jQuery(function () {
jQuery('#quick_reply input[name="post"]').click(function(a){
a.preventDefault();
var g = jQuery("#text_editor_textarea").sceditor('instance').val();
var href = jQuery('a[href*="mode=reply"]').attr("href");
var value = jQuery("#text_editor_textarea").sceditor("instance").val().replace(/\s/g, '').length;
if(10 <= value){
jQuery('<div class="lreply" style="color: red;font-weight: bold; text-transform: uppercase;"><br>Sua mensagem está sendo enviada...</div>').appendTo(".frm-buttons");
jQuery.post(href, {
            "message" : g,
            "auth[]": jQuery("#quick_reply input[name='auth[]']:last").val(),
            "lt" : jQuery("#quick_reply input[name='lt']").val(),
            "tid" : jQuery("#quick_reply input[name='tid']").val(),
            "attach_sig" : "1" ,
            "post": "Send"
}, function(t) {
console.log(t);
if(t.indexOf("Flood") != -1){
alert("Calma... Espere 5 segundos para postar.");
jQuery(".lreply").fadeOut(300);
}
if(t.indexOf("A new") != -1){
alert("Oops... Parece que outra pessoa postou junto com você. Para evitarmos problemas, copie o código da caixa de texto e tente de novo!");
jQuery(".lreply").fadeOut(300);
}
if(jQuery(t).find(".message a:first").attr('href').length >1) {
var f = jQuery(t).find(".message a:first").attr('href');
jQuery.get(f , function(z){
jQuery("#quick_reply input[name='auth[]']:last").val(jQuery(z).find("#quick_reply input[name='auth[]']:last").val());
jQuery("#quick_reply input[name='lt']").val(jQuery(z).find("#quick_reply input[name='lt']").val());
jQuery(z).find(".post:last").hide().insertAfter(".post:last").slideDown(400);
});
jQuery("#text_editor_textarea").sceditor('instance').val("");
jQuery(".lreply").fadeOut(300);
}
});
}
else {
alert("Poste no mínimo 10 caracteres para enviar a mensagem.");
}
});
});

Ao meu ver, passei o errado, desculpe.
Em fim... Teria como por o mesmo efeito no JS acima ?
iScroll

iScroll
Super Membro

Membro desde : 08/03/2015
Mensagens : 1701
Pontos : 2311

http://ultimatelife.forumeiros.com

Ir para o topo Ir para baixo

Principal Contribuidor

Tópico resolvido Re: Bloqueio de double post arrumado

Mensagem por Shek 26.02.17 19:56

Código:
//By doannamthai-getover || forumotion-forumvi ;
jQuery(function() {
    jQuery('#quick_reply input[name="post"]').click(function(a) {
        a.preventDefault();
        var g = jQuery("#text_editor_textarea").sceditor('instance').val();
        var href = jQuery('a[href*="mode=reply"]').attr("href");
        var value = jQuery("#text_editor_textarea").sceditor("instance").val().replace(/\s/g, '').length;
        if (10 <= value) {
            jQuery('<div class="lreply" style="color: red;font-weight: bold; text-transform: uppercase;"><br>Sua mensagem está sendo enviada...</div>').appendTo(".frm-buttons");
            jQuery.post(href, {
                "message": g,
                "auth[]": jQuery("#quick_reply input[name='auth[]']:last").val(),
                "lt": jQuery("#quick_reply input[name='lt']").val(),
                "tid": jQuery("#quick_reply input[name='tid']").val(),
                "attach_sig": "1",
                "post": "Send"
            }, function(t) {
                console.log(t);
                if (t.indexOf("Flood") != -1) {
                    alert("Calma... Espere 5 segundos para postar.");
                    jQuery(".lreply").fadeOut(300);
                }
                if (t.indexOf("A new") != -1) {
                    alert("Oops... Parece que outra pessoa postou junto com você. Para evitarmos problemas, copie o código da caixa de texto e tente de novo!");
                    jQuery(".lreply").fadeOut(300);
                }
                if (jQuery(t).find(".message a:first").attr('href').length > 1) {
                    var f = jQuery(t).find(".message a:first").attr('href');
                    jQuery.get(f, function(z) {
                        jQuery("#quick_reply input[name='auth[]']:last").val(jQuery(z).find("#quick_reply input[name='auth[]']:last").val());
                        jQuery("#quick_reply input[name='lt']").val(jQuery(z).find("#quick_reply input[name='lt']").val());
                        jQuery(z).find(".post:last").hide().insertAfter(".post:last").slideDown(400);
                  jQuery('form#quick_reply').before("<div align='center' style='padding: 5px;'>Você deve aguardar alguns para postar novamente.</div>").remove();
                    });
                    jQuery("#text_editor_textarea").sceditor('instance').val("");
                    jQuery(".lreply").fadeOut(300);
                }
            });
        } else {
            alert("Poste no mínimo 10 caracteres para enviar a mensagem.");
        }
    });
});
Clica no botão Resolvido se tudo estiver OK, para você. Piscada
Shek

Shek
Principal Contribuidor
Principal Contribuidor

Membro desde : 11/04/2009
Mensagens : 18896
Pontos : 22793

https://shiftactive.blogspot.com/ https://www.facebook.com/ShiftActif https://twitter.com/ShiftActif

Ir para o topo Ir para baixo

Tópico resolvido Re: Bloqueio de double post arrumado

Mensagem por iScroll 26.02.17 20:39

Perfeito! Obrigado Shek!
iScroll

iScroll
Super Membro

Membro desde : 08/03/2015
Mensagens : 1701
Pontos : 2311

http://ultimatelife.forumeiros.com

Ir para o topo Ir para baixo

Principal Contribuidor

Tópico resolvido Re: Bloqueio de double post arrumado

Mensagem por Shek 26.02.17 21:25

Bloqueio de double post arrumado Symbol10 Questão marcada como Resolvida ou o Autor solicitou que ela fosse arquivada.

Tópico marcado como Resolvido e movido para "Questões resolvidas".
Shek

Shek
Principal Contribuidor
Principal Contribuidor

Membro desde : 11/04/2009
Mensagens : 18896
Pontos : 22793

https://shiftactive.blogspot.com/ https://www.facebook.com/ShiftActif https://twitter.com/ShiftActif

Ir para o topo Ir para baixo

Ver o tópico anterior Ver o tópico seguinte Ir para o topo

- Tópicos semelhantes

Permissões neste sub-fórum
Não podes responder a tópicos