[Tutorial] Anti double post (mesclagem de tópicos)
Página 1 de 1 • Compartilhe
Informações:
Autor: Daemon
Versões: Todas as versões
Introdução: Anti double post (mesclagem de tópicos)
Instalação:
Acesse:
Então crie um novo javascript com investimento nos topicos com esse código:Painel de controle ->> Modulos ->> HTML & Javascripts ->> Gestão dos códigos Javascripts
- Código:
$(function() {
if (!_userdata.session_logged_in) {
return false;
}
var lastposting = $('.post:last').find('.author a, .name, .user a[href^="/u"]').text(),
user = _userdata.username;
if(lastposting == user) {
$('head').append(
'<style type="text/css">' +
'.warn_merge {' +
' background: #f3e3e6 url(http://i.imgur.com/Hkdx7rb.png) repeat-x 0 0;' +
' color: #80001c;' +
' padding: 10px;' +
' border: 1px solid #e599aa;' +
' text-shadow: rgba(255,255,255,0.55) 0px 1px 0px;' +
' line-height: 1.6;' +
' font-size: 12px;' +
' -webkit-box-shadow: rgba(0,0,0,0.1) 0px 1px 3px;' +
' -moz-box-shadow: rgba(0,0,0,0.1) 0px 1px 3px;' +
' box-shadow: rgba(0,0,0,0.1) 0px 1px 3px;' +
'}' +
'</style>'
);
var text = '<div class="warn_merge"><strong>Atenção:</strong> Nosso sistema identificou que você fez a última postagem deste tópico, seu novo post será mesclado com o seu último.</div>';
var quickreply = $('#quick_reply');
quickreply.prepend(text);
quickreply.find('input[name="post"]').click(function(d) {
d.preventDefault();
var link = $('.post:last a[href*="mode=editpost"]').attr('href'),
newValue = $('#text_editor_textarea').sceditor('instance').val();
$.get(link, function(e) {
if(!$.trim(newValue)) {
alert("Seu post está vazio");
} else {
var currentValue = $(e).find('#text_editor_textarea').val(),
title = $(e).find('input[name="subject"]').val();
if(!$.trim(title)) {
title = title;
} else {
title = '';
}
$.post(link, {
'message': currentValue+'\n\n[hr]\n'+newValue,
'post': '1',
'subject': title
}, function(e) {
var href = $(e).find('a[href^="/viewtopic"]').attr('href');
location.href = href;
});
}
});
});
}
});
Resultado:
Tópicos semelhantes
Cria uma conta ou logue para postar uma mensagem.
Você precisa ser um membro, para poder postar uma resposta.
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|