About reputation bar

Go down

Solved About reputation bar

Post by ArmorKiller on December 7th 2018, 4:59 pm

Hi guys, Im using reputation bar by @ange tuteur and its a great code btw thanks for sharing this great code/script ange & other people who contribute for that code. Smile

what i want here ...

1. it is possible to make the green bar becomes red bar when it comes to minus points? with the same level from the green bar. anyone can help me how to do the code things for this? See the example pic below for the red bar minus reputation

Spoiler:


and the last.. if this too much please skip this Very Happy  

2. it is possible to change the description of the green bar per level.

Example : the green bars description showing Reputation 1 ( Next : 1/500 ) , can we just change the description to like this : Reputation 1 ( +Username+ has starting to become famous now ) Or see the pic below for the example

Spoiler:


from this ( above ) to this ( below )




Note : the bar reputation code by ange is little bit from mine, im using the code from luffy to suit the FAE template. Here's the code

Code:
$(document).ready(function() {
 
  var version = 'phpbb3';
          var settings = {
                      repName : 'Reputation',
                      repStyle : 'block',
                      repImage : 'https://i.servimg.com/u/f57/18/21/41/30/star12.png'
                    };
 
 var repLv = {
          lv1 : 1,
          lv2 : 500,
          lv3 : 750,
          lv4 : 1000,
          lv5 : 3000,
          lv6 : 5000,
          lv7 : 7500,
          lv8 : 9000,
          lv9 : 10000,
          lv10 : 15000
        };
 
 
 
if (settings.repStyle.toLowerCase() == 'block') { var repBlock = '<span id="rLv" class="repuBlock">' }
    else if (settings.repStyle.toLowerCase() == 'image') { var repBlock = '<img id="rLv" src="'+settings.repImage+'"/>' }
    else { var repBlock = '<span id="rLv" class="repuBlock">' }
    var ver = { phpbb2 : version.toLowerCase() == 'phpbb2', phpbb3 : version.toLowerCase() == 'phpbb3', punbb : version.toLowerCase() == 'punbb', invision : version.toLowerCase() == 'invision' };
    var reg = new RegExp('.*'+settings.repName+'\\s+:\\s+(\\d+).*');
 
  if (ver.phpbb3 || ver.punbb || ver.invision) {
      if (ver.phpbb3 || ver.invision) { var profSel = '.postprofile'; var addRepu = $(this).find('dt').append('<div id="repu">'); }
      else if (ver.punbb) { var profSel = '.user'; var addRepu = $(this).find('.user-ident').prepend('<div id="repu">'); }
      $(profSel).each(function() {
          var rep = Number($(this).text().replace(reg,'$1'));
          addRepu;
              if (rep >= repLv.lv1) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2 }
              if (rep >= repLv.lv2) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv3 }
              if (rep >= repLv.lv3) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv4 }
              if (rep >= repLv.lv4) {$(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv5 }
              if (rep >= repLv.lv5) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv6 }
              if (rep >= repLv.lv6) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv7 }
              if (rep >= repLv.lv7) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv8 }
              if (rep >= repLv.lv8) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv9 }
              if (rep >= repLv.lv9) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv10 }
              if (rep >= repLv.lv10) { $(this).find('#repu').append(repBlock); var next = 'MAX' }
              $(this).find('#repu').attr('title','Reputation ' + $(this).find('#rLv').length + '\nNext: (' + next +  ')');
          });
        }
 
      else if (ver.phpbb2) {
          $('td .postdetails.poster-profile').each(function() {
              var rep = Number($(this).text().replace(reg,'$1'));
              $(this).parent().find('.name').next().after('<div id="repu">');
              if (rep >= repLv.lv1) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2  }
              if (rep >= repLv.lv2) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv3  }
              if (rep >= repLv.lv3) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv4  }
              if (rep >= repLv.lv4) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv5  }
              if (rep >= repLv.lv5) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv6  }
              if (rep >= repLv.lv6) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv7  }
              if (rep >= repLv.lv7) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv8  }
              if (rep >= repLv.lv8) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv9  }
              if (rep >= repLv.lv9) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv10  }
              if (rep >= repLv.lv10) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv11  }
              if (rep >= repLv.lv11) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv12  }
              if (rep >= repLv.lv12) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv13  }
              if (rep >= repLv.lv13) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv14  }
              if (rep >= repLv.lv14) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv15  }
              if (rep >= repLv.lv15) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv16  }
              if (rep >= repLv.lv16) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv17  }
              if (rep >= repLv.lv17) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv18  }
              if (rep >= repLv.lv18) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv19  }
              if (rep >= repLv.lv19) { $(this).parent().find('#repu').append(repBlock); var next = rep + '/' + repLv.lv20  }
              if (rep >= repLv.lv20) { $(this).parent().find('#repu').append(repBlock); var next = 'MAX'  }
              $(this).parent().find('#repu').attr('title','Reputation level ' + $(this).parent().find('#rLv').length  + '\nNext : ('  + next + ')');
          });
        }
    });
every answers will be greatly appreciated!!! :rose: Good


Last edited by ArmorKiller on December 10th 2018, 5:38 pm; edited 1 time in total
avatar
ArmorKiller
Forumember

Posts : 36
Reputation : 1
Language : Indonesia

http://rfps-community.forumotion.com

Back to top Go down

Solved Re: About reputation bar

Post by ArmorKiller on December 8th 2018, 7:27 pm

bump
avatar
ArmorKiller
Forumember

Posts : 36
Reputation : 1
Language : Indonesia

http://rfps-community.forumotion.com

Back to top Go down

Solved Re: About reputation bar

Post by SarkZKalie on December 9th 2018, 8:40 pm

You have to focus to these lines
Code:
if (rep >= repLv.lv10) { $(this).find('#repu').append(repBlock); var next = 'MAX' }
   $(this).find('#repu').attr('title','Reputation ' + $(this).find('#rLv').length + '\nNext: (' + next +  ')');
First of all, search and locate
Code:
if (rep >= repLv.lv1) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2 }
Replace by
Code:
if (rep >= repLv.lv1) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2; var text = 'text-you-want-1' ; }
Do the same thing to others, for example :
Code:
if (rep >= repLv.lv2) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv3; var text = 'text-you-want-2' ; }
Next step, replace this one
Code:
$(this).find('#repu').attr('title','Reputation ' + $(this).find('#rLv').length + '\nNext: (' + next +  ')');
by
Code:
$(this).find('#repu').attr('title', 'Reputation level ' + $(this).find('#rLv').length + '\n' + text + '\nNext : (' + next + ')');

Demo HERE


avatar
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 968
Reputation : 159
Language : English

http://rotavn.forumotion.com

Back to top Go down

Solved Re: About reputation bar

Post by ArmorKiller on December 10th 2018, 5:54 am

@SarkZKalie wrote:You have to focus to these lines
Code:
if (rep >= repLv.lv10) { $(this).find('#repu').append(repBlock); var next = 'MAX' }
   $(this).find('#repu').attr('title','Reputation ' + $(this).find('#rLv').length + '\nNext: (' + next +  ')');
First of all, search and locate
Code:
if (rep >= repLv.lv1) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2 }
Replace by
Code:
if (rep >= repLv.lv1) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv2; var text = 'text-you-want-1' ; }
Do the same thing to others, for example :
Code:
if (rep >= repLv.lv2) { $(this).find('#repu').append(repBlock); var next = rep + '/' + repLv.lv3; var text = 'text-you-want-2' ; }
Next step, replace this one
Code:
$(this).find('#repu').attr('title','Reputation ' + $(this).find('#rLv').length + '\nNext: (' + next +  ')');
by
Code:
$(this).find('#repu').attr('title', 'Reputation level ' + $(this).find('#rLv').length + '\n' + text + '\nNext : (' + next + ')');

Demo HERE

Thanks SarkZKalie! it works great so far..  Bravo Good 

but i've changed my mind to remove the level system description, how to do it? i mean like this : 


thats example level 10 reputation, i already delete some script but it appears some script still there and its showing to be 
" 0 " on every level. how to remove that? 



and last thing, is it possible to make the green bar becomes red bar when someone have minus reputation with the same system above? ( sorry if this too much to ask )  :rose:
avatar
ArmorKiller
Forumember

Posts : 36
Reputation : 1
Language : Indonesia

http://rfps-community.forumotion.com

Back to top Go down

Solved Re: About reputation bar

Post by SarkZKalie on December 10th 2018, 5:26 pm

Recommend to redo your changes, back to default main script. Do not touch anything if you don't how to play with it.

What are you talking about level system description thing?

1) If it was Reputation level x, simply do search this one
Code:
$(this).find('#repu').attr('title', 'Reputation level ' + $(this).find('#rLv').length + '\n' + text + '\nNext : (' + next + ')');
And replace by
Code:
$(this).find('#repu').attr('title', text + '\nNext : (' + next + ')');
2) This reputation system don't have a minus point thing, so you have to ask its creator.


avatar
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 968
Reputation : 159
Language : English

http://rotavn.forumotion.com

Back to top Go down

Solved Re: About reputation bar

Post by ArmorKiller on December 10th 2018, 5:36 pm

@SarkZKalie wrote:Recommend to redo your changes, back to default main script. Do not touch anything if you don't how to play with it.

What are you talking about level system description thing?

1) If it was Reputation level x, simply do search this one
Code:
$(this).find('#repu').attr('title', 'Reputation level ' + $(this).find('#rLv').length + '\n' + text + '\nNext : (' + next + ')');
And replace by
Code:
$(this).find('#repu').attr('title', text + '\nNext : (' + next + ')');
2) This reputation system don't have a minus point thing, so you have to ask its creator.

thanks for the last script thats how i want! thank you so much Mr.SarkZKalie, problem solved. Da best! rock salut Yes

GBU :rose:
avatar
ArmorKiller
Forumember

Posts : 36
Reputation : 1
Language : Indonesia

http://rfps-community.forumotion.com

Back to top Go down

Solved Re: About reputation bar

Post by SarkZKalie on December 10th 2018, 5:48 pm

Problem solved & topic archived.
Please read our forum rules:  ESF General Rules


avatar
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 968
Reputation : 159
Language : English

http://rotavn.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum