24

About

Displays user reputation in hexadecimal. The code is quite simple if you want to do any tweaks. For users with rep >= 0x10000, it switches the font to Arial Narrow to prevent breaking layouts.

Download

Install | View source

Platform

Tested on Firefox 4.0 and Chrome 10.0, on Windows 7. Requires Greasemonkey on Firefox.

License

Do whatever you want, as long as you don't sell it or claim you wrote it. If you make any cool modifications, let me know!

Source

It seems that userscripts.org is dying. Here is the code:

// ==UserScript==
// @name           hex stack overflow rep
// @namespace      stackoverflow
// @description    Displays user's rep in hexadecimal on stack overflow
// @include       http://stackoverflow.com/*
// @include       http://meta.stackoverflow.com/*
// @include       http://superuser.com/*
// @include       http://meta.superuser.com/*
// @include       http://serverfault.com/*
// @include       http://meta.serverfault.com/*
// @include       http://askubuntu.com/*
// @include       http://meta.askubuntu.com/*
// @include       http://answers.onstartups.com/*
// @include       http://meta.answers.onstartups.com/*
// @include       http://nothingtoinstall.com/*
// @include       http://meta.nothingtoinstall.com/*
// @include       http://seasonedadvice.com/*
// @include       http://meta.seasonedadvice.com/*
// @include       http://crossvalidated.com/*
// @include       http://askdifferent.com/*
// @include       http://meta.crossvalidated.com/*
// @include       http://stackapps.com/*
// @include       http://*.stackexchange.com/*
// @exclude       http://chat.stackexchange.com/*
// @exclude       http://api.*.stackexchange.com/*
// @exclude       http://data.stackexchange.com/*
// @exclude       http://area51.stackexchange.com/*
// @author         Kip Robinson - http://stackoverflow.com/users/18511/kip
// ==/UserScript==

(function() {
   function with_jquery(f) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.textContent = "(" + f.toString() + ")(jQuery)";
    document.body.appendChild(script);
  }; 

  with_jquery(function($)
  {
    $('.reputation-score').each(function() {
      var title = $(this).attr('title');
      var text = $(this).text();
      var rep = 1;

      if(text.indexOf('k') < 0)
      {
        rep = parseInt(text.replace(/,/g, ''));
      }
      else
      {
        rep = parseInt(title.replace(/\D/g, ''));

        //if no rep was in the tooltip, convert the truncated rep to hex
        if(isNaN(rep))
          rep = Math.round(1000 * parseFloat(text.replace(/[k,]/gi, '')));
      }

      $(this).text('x' + rep.toString(16).toUpperCase());
      if(rep >= 0x10000)
        $(this).css('font-family', 'Arial Narrow,' + $(this).css('font-family'));
    });
  });

})();
3
  • 19
    useless AND I LOVE IT! Apr 13, 2011 at 20:06
  • 1
    I believe "useless" would be an understatement, but like many useless things, it's quite humorous. :) Sep 2, 2011 at 0:40
  • 1
    @Kip See Octal user reputation, a derivative of this script.
    – ctype.h
    Mar 6, 2013 at 23:30

4 Answers 4

5

Nice script! I modified your script slightly to obtain a script that does not show exact reputation but just category of the user. It can easily be modified to show symbols in place of the numbers:

// ==UserScript==
// @name           hex stack overflow rep
// @namespace      stackoverflow
// @description    Displays user's rep in hexadecimal on stack overflow
// @include       http://stackoverflow.com/*
// @include       http://meta.stackoverflow.com/*
// @include       http://superuser.com/*
// @include       http://meta.superuser.com/*
// @include       http://serverfault.com/*
// @include       http://meta.serverfault.com/*
// @include       http://askubuntu.com/*
// @include       http://meta.askubuntu.com/*
// @include       http://answers.onstartups.com/*
// @include       http://meta.answers.onstartups.com/*
// @include       http://nothingtoinstall.com/*
// @include       http://meta.nothingtoinstall.com/*
// @include       http://seasonedadvice.com/*
// @include       http://meta.seasonedadvice.com/*
// @include       http://crossvalidated.com/*
// @include       http://askdifferent.com/*
// @include       http://meta.crossvalidated.com/*
// @include       http://stackapps.com/*
// @include       http://*.stackexchange.com/*
// @exclude       http://chat.stackexchange.com/*
// @exclude       http://api.*.stackexchange.com/*
// @exclude       http://data.stackexchange.com/*
// @exclude       http://area51.stackexchange.com/*
// @author         Kip Robinson - http://stackoverflow.com/users/18511/kip
// ==/UserScript==

(function() {
  function with_jquery(f) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.textContent = "(" + f.toString() + ")(jQuery)";
    document.body.appendChild(script);
  }; 

  with_jquery(function($) {
    $('.reputation-score').each(function() {
      var title = $(this).attr('title');
      var text = $(this).text();
      var rep = 1;

      if(text.indexOf('k') < 0) {
        rep = parseInt(text.replace(/,/g, ''));
      } else {
        rep = parseInt(title.replace(/\D/g, ''));

        //if no rep was in the tooltip, convert the truncated rep to hex
        if(isNaN(rep))
          rep = Math.round(1000 * parseFloat(text.replace(/[k,]/gi, '')));
      }

      if(rep >= 20000) $(this).text('20K+');       // 'Trusted'
      else if(rep >= 10000) $(this).text('10K+');  // 'Moderator'
      else if(rep >= 3000) $(this).text('3K+');    // 'Scope Definer' 'Closer'
      else if(rep >= 2000) $(this).text('2K+');    // 'Editor'
      else if(rep >= 1000) $(this).text('1K+');    // 'Expert'
      else if(rep >= 500) $(this).text('500+');    // 'Retagger'
      else if(rep >= 200) $(this).text('200+');    // 'Contributer'
      else if(rep >= 50) $(this).text('50+');      // 'Commentator'
      else if(rep >= 15) $(this).text('15+');      // 'Voter'
      else $(this).text('!');                      // 'New'

//    if(rep >= 0x10000)
//      $(this).css('font-family', 'Arial Narrow,' + $(this).css('font-family'));
    });
  });

})()
2

Here is another one which hides vote counts and only shows range:


// ==UserScript==
// @name           se symb votes
// @namespace      stackoverflow
// @description    Displays vote counts symbolicly on SE network
// @include       http://stackoverflow.com/*
// @include       http://meta.stackoverflow.com/*
// @include       http://superuser.com/*
// @include       http://meta.superuser.com/*
// @include       http://serverfault.com/*
// @include       http://meta.serverfault.com/*
// @include       http://askubuntu.com/*
// @include       http://meta.askubuntu.com/*
// @include       http://answers.onstartups.com/*
// @include       http://meta.answers.onstartups.com/*
// @include       http://nothingtoinstall.com/*
// @include       http://meta.nothingtoinstall.com/*
// @include       http://seasonedadvice.com/*
// @include       http://meta.seasonedadvice.com/*
// @include       http://crossvalidated.com/*
// @include       http://askdifferent.com/*
// @include       http://meta.crossvalidated.com/*
// @include       http://stackapps.com/*
// @include       http://*.stackexchange.com/*
// @exclude       http://chat.stackexchange.com/*
// @exclude       http://api.*.stackexchange.com/*
// @exclude       http://data.stackexchange.com/*
// @exclude       http://area51.stackexchange.com/*
// @author          
// ==/UserScript==

(function() {
  function with_jquery(f) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.textContent = "(" + f.toString() + ")(jQuery)";
    document.body.appendChild(script);
  }; 

  with_jquery(function($) {
    $('.vote-count-post').each(function() {
      var title = $(this).attr('title');
      var text = $(this).text();
      var vote = 0;

      if(text.indexOf('k') < 0) {
        vote = parseInt(text.replace(/,/g, ''));
      } else {
        vote = parseInt(title.replace(/\D/g, ''));

    //if no vote was in the tooltip, convert the truncated vote to hex
        if(isNaN(vote))
          vote = Math.round(1000 * parseFloat(text.replace(/[k,]/gi, '')));
      }

      if(vote >= 100) $(this).text('100+');      
      else if(vote >= 25) $(this).text('25+'); 
      else if(vote >= 10) $(this).text('10+');  
      else if(vote >= 1)  $(this).text('+');  
      else if(vote >= 0)  $(this).text('0');
      else $(this).text('-');

    });
  });

})()
1

I'd like to have decimal number next to it, or in a tooltip. Is this possible?

3
  • 2
    To show original rep in a tooltip, after $(this).text(....);, you would add: $(this).attr('title', rep);
    – Kip
    Nov 27, 2017 at 2:43
  • to show it next to it might mess up layout, but you would just append it to the string argument passed to $(this).text(....);. Something like: $(this).text('x' + rep.toString(16).toUpperCase() + ' - ' + rep.toString());
    – Kip
    Nov 27, 2017 at 2:45
  • 1
    In a tooltip you could chain it together $(this).text(....).attr('title',rep); and use one statement instead of two Sep 9, 2018 at 22:26
1

HTTPS support, changes your own rep in the top bar as well.

Great script btw :D

// ==UserScript==
// @name           hex stack overflow rep
// @namespace      stackoverflow
// @description    Displays user's rep in hexadecimal on stack overflow
// @include       http*://*stackoverflow.com/*
// @include       http*://*superuser.com/*
// @include       http*://*serverfault.com/*
// @include       http*://*askubuntu.com/*
// @include       http*://*.stackexchange.com/*
// @include       http*://*stackapps.com/*
// @author         Kip Robinson
// ==/UserScript==

!function() {
   function with_jquery(f) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.textContent = "(" + f.toString() + ")(jQuery)";
    document.body.appendChild(script);
  }; 

  with_jquery(function() {
    function calculate(x){
      var title = $(x).attr('title'),
      text = $(x).text(),
      rep = 1;

      if(text.indexOf('k') < 0){rep = parseInt(text.replace(/,/g, ''));}
      else{
        rep = parseInt(title.replace(/\D/g, ''));

        //if no rep was in the tooltip, convert the truncated rep to hex
        if(isNaN(rep)) rep = Math.round(1000 * parseFloat(text.replace(/[k,]/gi, '')));
      }

      $(x).text('0x' + rep.toString(16).toUpperCase()).attr('title',rep);
    }
    $('.-rep').each(function() {
      calculate(this);
    });
    $('.reputation-score').each(function() {
      calculate(this);
    });
  });

}();

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .