Skip to content

Instantly share code, notes, and snippets.

@lsloan
Created July 16, 2015 18:39
Show Gist options
  • Save lsloan/3c4b8734276af859d84b to your computer and use it in GitHub Desktop.
Save lsloan/3c4b8734276af859d84b to your computer and use it in GitHub Desktop.
Replace RequestBin's relative times with absolute ones.
$('div.span2 span').each(function() {
$span = $(this);
$span.text($span.attr('title'));
});
@lsloan
Copy link
Author

lsloan commented Jul 16, 2015

RequestBin shows relative timestamps on the requests that it's received, like "7s ago", "15m ago", "2h ago", "1d ago", etc. Those are nice, but if you refresh the page expecting to see new content, but there isn't any, it takes a while to realize that the request with the "3m ago" time is the same one that had "1m ago" just a little while earlier. If they would show the absolute timestamp, changes would be noticed easier.

Fortunately, in their HTML, RequestBin wraps the relative timestamps with span elements that have the absolute timestamp in their title attributes. Therefore, I worked out this quick jQuery operation to find all of those elements and replace their text with the value from their title attributes. It could use a little work, though. It may be better to have both the absolute and relative times shown together. It would also be nice to not have the direct links for the requests overwritten.

To make this the most useful, it could be put into a bookmarklet to be run whenever the user chooses. It could also be put into a userscript, executed by TamperMonkey or GreaseMonkey every time the page loads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment