24

Important: this no longer works and needs a patch; see my answer.


I've just finished creating yet another greasemonkey script.

This script will display your reputation earned today and the time till the next cycle begins. If you have reached your daily reputation limit, the text will turn red.

EDIT: Fixed a bug with the countdown.

Screenshot

http://userscripts.org/scripts/show/55025

6
  • I noticed the bug last night...was going to mention it today (well, I guess I just did) but seeing that you already caught it I'll just shut up. :)
    – Sampson
    Aug 5, 2009 at 20:29
  • Very very nice script. I got burned today for going over the limit today and lost probably about 70 or so potential rep.
    – Unknown
    Aug 13, 2009 at 23:30
  • Great script, but it seems to have recently stopped working. Has the activity page changed its output? Oct 23, 2009 at 18:14
  • @ire_and_curses: The script has been fixed. Nov 11, 2009 at 21:17
  • 2
    It appears the script is broken now? Apr 30, 2010 at 18:42
  • 2
    can this please be moved to stackapps.com/?tab=scripts as necessary? Or flag for deletion. Jul 31, 2011 at 22:50

5 Answers 5

4

This no longer works but I fixed it. Find the line with var separator and replace it with:

var separator = logout_link.parent().prev().find('span:last');

Also, would anyone be interested if I were to fix the reputation cap coloring too? Right now it colors it in red if >= 200, but that's wrong with the new changes.

1
3

Nice work. I love the live countdown too.

1
  • 1
    well, if it's greasemonkey approved, it's good enough for me. ;)
    – Jeff Yates
    Aug 4, 2009 at 14:06
2

I've rewritten @Nick Craver's Chrome port to work with the latest SE UI changes.

The latest version of it will (for now) live as a gist on github.

Edit just came across a few bugs in this version; update pending. fix't.

6
  • consider posting it on StackApps
    – Benjol
    Mar 14, 2011 at 14:40
  • I consider Nick to be the original creator of the script, so I'd sooner let him do it (and receive the credit).
    – Matt Ball
    Mar 14, 2011 at 14:46
  • thanks, it works great!
    – Karthik T
    Jan 3, 2013 at 7:53
  • It seems to consider only 200 as a cap and doesnt take into consideration all accepted answers. Is it possible to fix this?
    – Karthik T
    Jan 7, 2013 at 10:17
  • @KarthikT not sure what you mean. 200 rep is the daily cap, ignoring accepted answers and bounties.
    – Matt Ball
    Jan 7, 2013 at 14:31
  • @MattBall I mean that the daily cap is actually 200 + accepted answers + bounties. i.e if I have 3 accepted answers, the daily cap is 245, but the count goes red at 200 anyway which is missleading.
    – Karthik T
    Jan 7, 2013 at 23:25
1

First, nice work on this Andrew, the interface for this is simple and very useful. (Also very interested in that iPhone app).

In case anyone else can use this, I made some slight adjustments to Andrew's script to make a Chrome version (for myself really, this thing's handy...but if others can benefit have at it). It doesn't work in both...sorry not a Firefox daily user anymore :)

// ==UserScript==
// @name           SO Show Today's Reputation
// @namespace      SO_TODAY_REP
// @description    Shows today's reputation score and time till new session begins.
// @include        http://stackoverflow.com/*
// @include        http://serverfault.com/*
// @include        http://superuser.com/*
// @include        http://meta.stackoverflow.com/*
// ==/UserScript==

(function(){
  var script = document.createElement("script");
  script.textContent = "(" + topBar.toString() + ")();";
  document.body.appendChild(script);

  function topBar() {
    $(function() {
      var logout_link = $("#topbar a:first");

      if(logout_link.length) {
        $("#topbar").css('max-width', '1000px');
        var link = $("#topbar a[href^='/users/recent/']:first");
        var today = new Date();
        var UTCtoday = today.getUTCFullYear() + '-' + GM_fixNumber(today.getUTCMonth()+1) + '-' + GM_fixNumber(today.getUTCDate());
        var url = (link.attr('href').match(/^[^?]+/))[0] + '?StartDate=' + UTCtoday + '&EndDate=' + UTCtoday;

        $('<span></span>').load(url + " div#tabs a[href^='/users/recent/'][href*='tab=reputation']:first span.bounty-indicator-tab:first" , function() {
          var today_rep = $(this).text();
          $(this).remove();

          if(!today_rep) today_rep = 0;

          var today_rep_int = parseInt(today_rep, 10);

          var separator = logout_link.parent().prev().find('span:last');
          separator.clone().insertBefore(separator);

          var rep_score = $('<span class="reputation-score"></span>').text(' ' + today_rep).insertBefore(separator);

          var time_score = $('<span class="badgecount"></span>').insertBefore(separator);

          if(today_rep_int >= 200) {
            rep_score.css('color', '#BB0000');
            time_score.css('color', '#BB8888');
          }

          var timer = function() {
            var now = new Date();
            var nextSess = new Date(now.getFullYear(), now.getMonth(), now.getDate()+1, 0, 0-now.getTimezoneOffset(), 0);

            if(nextSess.getTime() <= now.getTime()) {
              nextSess.setDate(nextSess.getDate()+1);
            }

            var diff = parseInt((nextSess.getTime() - now.getTime()) / 1000, 10);

            var hours = parseInt((diff / 3600) % 24, 10);
            var minutes = parseInt((diff % 3600) / 60, 10);
            var seconds = diff % 60;

            var settext = GM_fixNumber(hours) + ':' + GM_fixNumber(minutes) + '.' + GM_fixNumber(seconds);

            time_score.text(' - ' + settext + ' ');
          };

          timer();

          setInterval(timer, 1000);
        });
      }      
    });
    function GM_fixNumber(num) {
      if(num < 10) return '0' + num;
      return num;
    }
  }
})();
4
  • Excellent. Thanks for the Chrome port.
    – Matt Ball
    Dec 8, 2010 at 16:09
  • The recent removal of the logout link from the top bar broke this script. Here's my fix for it: gist.github.com/825973. Just needed to change the logout_link selector.
    – Matt Ball
    Feb 26, 2011 at 16:45
  • @Matt - I made the same change when we moved the logout, forgot to update this - thanks! Feb 26, 2011 at 17:02
  • Dangit, the UI changes broke this durned thing again
    – Matt Ball
    Mar 11, 2011 at 4:50
0

It would be great if someone would rewrite it to use /reputation instead of /users/.

3
  • /reputation already reports the days you met the cap and exceeded the cap. Just look at the bottom of the report.
    – jjnguy
    Jul 20, 2010 at 21:27
  • Currently, it takes your currently earned reputation from your user page. I was asking if it could be rewritten to use /reputation, which is a smaller page.
    – Hello71
    Jul 21, 2010 at 14:34
  • I rewrote @Nick Craver's Chrome version to work with the latest UI changes. See my answer.
    – Matt Ball
    Mar 14, 2011 at 14:09

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