Advertisement
Guest User

IPB Like System

a guest
Jul 6th, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 2.11 KB | None | 0 0
  1. /*
  2.  *  Application: IPB Like System
  3.  *  Date: 16/02/2015
  4.  *  Version: 1.216022015
  5.  *  Copyright (c) 2015 Daemon <bestskins.forumeiros.com>
  6.  *  This work is free. You can redistribute it and/or modify it
  7.  */
  8. function bestskins_ls() {
  9.  
  10.     // Imagem de reputação
  11.     var plusImg = 'http://i.imgur.com/PTraX1a.png';
  12.  
  13.     for (var x = $('.vote'), i = 0, vote;(vote = x[i++]);) {
  14.         var 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.         botao = botao ? '<li><span onclick="bestskinsVoto(\'' + botao.firstChild.href + '\',this);" class="BS_like"><img src="' + plusImg + '" alt="+" class="rep_up"></span></li>' : '<li style="display: none;"><img src="' + plusImg + '" alt="+" class="rep_up"></li>';
  23.         var numrep = '<li>' + (qtd == 0 ? '<span class="reput_vote zero">' + qtd + '</span>' : '<span class="reput_vote positive">' + qtd + '</span>') + '</li>';
  24.         var htmlFinal =
  25.             '<div class="rep_bar clearfix" id="rep_post">' +
  26.             '       <ul class="bs_inline">' + botao + numrep + '</ul>' +
  27.             '</div>';
  28.         $('.postfoot', vote.parentNode.parentNode.parentNode.parentNode).before(htmlFinal);
  29.     }
  30.     x.remove();
  31. };
  32.  
  33. function bestskinsVoto(b, a) {
  34.     a.onclick = '#';
  35.     $.get(b, function() {
  36.         a.parentNode.style.display = 'none';
  37.         var verify = a.parentNode.nextSibling.firstChild.innerHTML;
  38.         if (verify == 0) {
  39.             a.parentNode.nextSibling.firstChild.classList.remove('zero'),
  40.             a.parentNode.nextSibling.firstChild.classList.add('positive');
  41.         }
  42.         var c = a.parentNode.nextSibling.firstChild,
  43.             b = parseInt(/\d+/.exec(c.innerHTML)[0]) + 1;
  44.         c.innerHTML = c.innerHTML.replace(/\d+/, b);
  45.     });
  46. };
  47. if (document.readyState === 'complete') {
  48.     bestskins_ls();
  49. } else {
  50.     document.addEventListener('DOMContentLoaded', function() {
  51.         bestskins_ls();
  52.     });
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement