Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Stack Exchange sites, edits that are made within 5 minutes of posting a question or answer aren't counted. This is called the grace period.

For example, if you post a new answer, and edit it after the 5-minute grace period, this is how it'll look like:

with edited link

If you make the edit within the grace period, then it'll look like:

without edited link

It'd be great if you can see a countdown timer that starts counting down immediately after you post a question or answer. Is there a script that does this?

share|improve this question
Sadly, bounties are mostly wasted on Stack Apps. Too few users and most of them are not that hungry for rep. – Brock Adams Nov 11 '14 at 9:54
@BrockAdams: Right, but I thought it wouldn't hurt trying. I have no use for rep here anyways :) – Amal Murali Nov 11 '14 at 10:50

Here's a Greasemonkey / Tampermonkey script that'll run a stop watch until an edit reaches 5 minutes of age. Give it a try and see what you think. It might have bugs, but it's close enough for government work I think. (That's a United States idiom meaning it has the mediocre quality one might expect from the lowest bidder, but it works well enough.) Bear in mind that it only works on new posts and post edits, not on comments.

Edit: I added the script to GitHub (direct install) so you can install it without having to copypaste this code block.

// ==UserScript==
// @name        SE realtime dates
// @namespace
// @description show Stack Exchange timestamps as realtime counters
// @include     /^https?:\/\/(\w+\.)?(stack(overflow|exchange|apps)|serverfault|superuser|askubuntu|onstartups|mathoverflow|mso)\.com\/.+/
// @version     1
// @grant       none
// ==/UserScript==

function setIntervalWithContext(code, delay, context) {
    return setInterval(function() {;
    }, delay);

function startTimer(el) {
    if (!el.title) return;
    this.el = el;
    this.interval = setIntervalWithContext(function() {
        if (!this.el) return clearInterval(this.interval);
        var x = (new Date() - new Date(this.el.title.replace(' ','T'))) / 1000;
        if (x>299&&x<360) this.el.innerHTML = '5 mins ago';
        if (isNaN(x) || x > 299) return clearInterval(this.interval);
        var m = Math.floor(x / 60) % 60,
            s = Math.floor(x % 60),
            s = (s < 10) ? '0' + s : s;
        this.el.innerHTML = m+':'+s+' ago';
    }, 250, this);

function addTimers() {
    while (timers.length) clearInterval(timers.pop());
    var timestamps = document.getElementsByClassName('relativetime');
    for (var i=0; i<timestamps.length; i++) {
        var stopwatch = new startTimer(timestamps[i]);

var timers = [];
addEventListener('click', function() { setTimeout(addTimers, 1000) }, true);
share|improve this answer
FYI: this script also edits the flag summary page and adds the timer to that too. – Ferrybig Feb 25 at 11:54

You must log in to answer this question.

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