Advertisement
Guest User

IPB Like System

a guest
Nov 24th, 2014
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. * Código: IPB Like System.
  3. * Data de criação: 18/07/2014.
  4. * Atualização: 18/11/2014.
  5. * Autor: Daemon.
  6. * Versão: 1.1.
  7. * Inspirado: IPB.
  8. * Acesse: http://bestskins.net.
  9. * Não distribuir, ou remover os créditos do autor.
  10. */
  11. function bestskins_ls() {
  12.    for(var x = $('.vote'), i = 0, vote; (vote = x[i++]); ) {
  13.                 var count = 0,
  14.                       qtd = 0,
  15.                       barra = $('.vote-bar', vote)[0],
  16.                       botao = $('.vote-button', vote)[0];                      
  17.                 if (barra) {
  18.                         var numbarra = barra.title.match(/\d+/g);
  19.                         qtd = Math.round(parseInt( numbarra[1] ) * parseInt( numbarra[0] )) / 100;
  20.                 }
  21.                
  22.                 //Imagem de reputação
  23.                 var reputation_UP = 'http://i.imgur.com/PTraX1a.png';
  24.  
  25.                 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>';
  26.                 var numrep = '<li>' + (qtd == 0 ? '<span class="reput_vote zero">' + qtd + '</span>' : '<span class="reput_vote positive">' + qtd + '</span>') + '</li>';
  27.                 var htmlFinal =
  28.                 '<div class="rep_bar clearfix" id="rep_post">' +
  29.                 '       <ul class="bs_inline">' + botao + numrep  + '</ul>' +
  30.                 '</div>';
  31.      $('.postfoot', vote.parentNode.parentNode.parentNode.parentNode).before( htmlFinal );
  32.    }
  33.    x.remove();
  34. };
  35. function bestskinsVoto(b,a) {
  36.   a.onclick = '#';
  37.     $.get(b, function() {
  38.      a.parentNode.style.display = 'none';
  39.      var verify = a.parentNode.nextSibling.firstChild.innerHTML;
  40.      if(verify == 0) {
  41.      a.parentNode.nextSibling.firstChild.classList.remove('zero'),
  42.      a.parentNode.nextSibling.firstChild.classList.add('positive');
  43.      }
  44.      var c = a.parentNode.nextSibling.firstChild, b = parseInt(/\d+/.exec(c.innerHTML)[0])+1;
  45.      c.innerHTML = c.innerHTML.replace(/\d+/,b);
  46.     });
  47. };
  48. if (document.readyState ===  'complete') {
  49.          bestskins_ls();
  50. } else {
  51.        document.addEventListener('DOMContentLoaded', function() {
  52.          bestskins_ls();
  53.        });
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement