Best Style

Você não está conectado. Conecte-se ou registre-se

Sistema Curtir nas Mensagens

Ver o tópico anterior Ver o tópico seguinte Ir para baixo  Mensagem [Página 1 de 1]

Sliw

Sliw
Administrador
Informações:
Autor: Daemon
Funcionalidade: Todas as versões




No tutorial a seguir, iremos ensinar como aplicar um sistema de curtir nas mensagens, substituindo o sistema atual de reputação.

Primeiramente acesse:
Painel de controle Visualização Imagens e Cores Cores Folha de estilo

e Adicione esse código em sua folha de estilo:

Código:
/*******CURTIR NO POST********/
  #rep_post .reput_vote {
  background-color: #daedfb;
  color: #666;
  -khtml-user-select: none;
  -moz-transition: all,0.15s;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-transition: all,0.15s;
  -webkit-touch-callout: none;
  -webkit-transition: all,0.15s;
  -webkit-user-select: none;
  background: #f0f0f0 url(https://cdn1.iconfinder.com/data/icons/social-media-13/24/Like-16.png) no-repeat 6px center;
  background-size: 12px;
  clear: both;
  color: #666;
  cursor: pointer;
  display: table;
  font-size: 11px;
  font-weight: 400;
  line-height: 18px;
  margin: 5px;
  padding: 3px 5px 3px 25px;
  text-align: right;
  transition: all,0.15s;
}
.reput_vote.zero {
  background-color: #6a6a6a;
}
 
 
  .BS_like:hover {
  background-color: #daedfb;
  color: #666;
}
.BS_like {
  -khtml-user-select: none;
  -moz-transition: all,0.15s;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-transition: all,0.15s;
  -webkit-touch-callout: none;
  -webkit-transition: all,0.15s;
  -webkit-user-select: none;
  background: #f0f0f0 url(https://cdn1.iconfinder.com/data/icons/social-media-13/24/Like-16.png) no-repeat 6px center;
  background-size: 12px;
  clear: both;
  color: #666;
  cursor: pointer;
  display: table;
  font-size: 11px;
  font-weight: 400;
  line-height: 18px;
  margin: 5px;
  padding: 3px 5px 3px 25px;
  text-align: right;
  transition: all,0.15s;
  user-select: none;
}

.BS_like:before {
  content: "Curtir";
}
 
  #rep_post .bs_inline {
  list-style: none;
}
 
  .BS_like:hover {
  background-color: #daedfb;
  color: #666;
}
 
  #rep_post {white-space: nowrap;margin: 6px 4px;float: right;}
#rep_post .bs_inline {list-style: none;}
#rep_post .bs_inline > li {display: inline-block;margin: 0 3px;}
#rep_post .bs_inline > li:first-child {margin-left: 0;}
#rep_post .bs_inline img {display: none;}
#rep_post span img {cursor: pointer;}


.reput_vote.positive {background-color: #8db13e;}
.reput_vote.zero {background-color: #6a6a6a;}

#rep_post .reput_vote:before {
  content: "Curtidas ";
}
/***********FIM CURTIR************/

Após feito isto, Acesse:
Painel de controle Modulos HTML & Javascript Gestão dos códigos Javascript

e Crie um novo Javascript com investimento nos tópicos com esse código:

Código:
/***
* Código: IPB Like System
* Data de criação: 18/07/2014
* Atualização: 31/03/2015
* Autor: Daemon
* Versão: 1.2
* Inspirado: IPB
* Acesse: http://bestskins.net & http://ajuda.forumeiros.com
* Não distribuir, ou remover os créditos do autor.
***/
function bestskins_ls() {
  // Imagem de reputação
  var reputation_UP = 'http://www.agrotube.com.br/images/seta_baixo.png';
  for(var x = $('.vote'), i = 0, vote; (vote = x[i++]); ) {
                var qtd = 0,
                    barra = $('.vote-bar', vote)[0],
                    botao = $('.vote-button', vote)[0];                     
                if (barra) {
                    var numbarra = barra.title.match(/\d+/g);
                        qtd = Math.round(parseInt( numbarra[1] ) * parseInt( numbarra[0] )) / 100;
                }
           
 
                botao = botao ? '<li><span onclick="bestskinsVoto(\'' + botao.firstChild.href + '\',this);" class="BS_like"><img src="' + reputation_UP + '" alt="+" class="rep_up"></span></li>' : '<li style="display: none;"><img src="' + reputation_UP + '" alt="+" class="rep_up"></li>';
                var numrep = '<li>' + (qtd == 0 ? '<span class="reput_vote zero">' + qtd + '</span>' : '<span class="reput_vote positive">' + qtd + '</span>') + '</li>';
                var htmlFinal =
                '<div class="rep_bar clearfix" id="rep_post">' +
                '      <ul class="bs_inline">' + botao + numrep  + '</ul>' +
                '</div>';
  $('.postfoot', vote.parentNode.parentNode.parentNode.parentNode).before( htmlFinal );
  }
  x.remove();
};
function bestskinsVoto(b,a) {
  a.onclick = '#';
    $.get(b, function() {
    a.parentNode.style.display = 'none';
    var verify = a.parentNode.nextSibling.firstChild.innerHTML;
    if(verify == 0) {
        a.parentNode.nextSibling.firstChild.classList.remove('zero'),
        a.parentNode.nextSibling.firstChild.classList.add('positive');
    }
    var c = a.parentNode.nextSibling.firstChild, b = parseInt(/\d+/.exec(c.innerHTML)[0])+1;
    c.innerHTML = c.innerHTML.replace(/\d+/,b);
    });
};
if (document.readyState ===  'complete') {
        bestskins_ls();
} else {
      document.addEventListener('DOMContentLoaded', function() {
        bestskins_ls();
      });
}

Esse Código só é funcional para PunBB, mas se for subir o tópico eu disse que era todas as funções correto? eu não menti... pra que funcione em outra função deves procurar essa linha no seu código Javascript:

Código:
$('.postfoot', vote.parentNode.parentNode.parentNode.parentNode).before( htmlFinal );

e alterar para esta:

Código:
$('.postbody', vote.parentNode.parentNode.parentNode).append( htmlFinal );

O resultado será este:

Sistema Curtir nas Mensagens RkF642t

https://beststyle.forumeiros.com

Sliw

Sliw
Administrador
Tutorial Aceito

https://beststyle.forumeiros.com

Ver o tópico anterior Ver o tópico seguinte Ir para o topo  Mensagem [Página 1 de 1]

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