Skip to content

Instantly share code, notes, and snippets.

@philwolstenholme
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philwolstenholme/bebd63911db7011a7a1b to your computer and use it in GitHub Desktop.
Save philwolstenholme/bebd63911db7011a7a1b to your computer and use it in GitHub Desktop.
Extended Jira timestamps
// ==UserScript==
// @name Extended Jira timestamps
// @namespace https://wolstenhol.me
// @version 0.1
// @author Phil Wolstenholme
// @match https://jira.ctidigital.com/*
// @grant none
// @downloadURL https://gist.githubusercontent.com/philwolstenholme/bebd63911db7011a7a1b/raw/ce8bde9d87d97377789e4d123f66461eed52848b/gistfile1.js
// @updateURL https://gist.githubusercontent.com/philwolstenholme/bebd63911db7011a7a1b/raw/ce8bde9d87d97377789e4d123f66461eed52848b/gistfile1.js
// ==/UserScript==
(function ($) {
function alterTimestamps() {
var now = new Date();
$("time.livestamp").each(function( index ) {
var timestamp = new Date($(this).attr('datetime'));
var differenceMilliseconds = (now - timestamp );
var differenceHours = Math.round((differenceMilliseconds % 86400000) / 3600000);
var differenceMinutes = Math.round(((differenceMilliseconds % 86400000) % 3600000) / 60000);
$(this).parent().attr('title', differenceHours + ' hour(s), ' + differenceMinutes + ' minute(s) ago');
});
}
(function triggerAlterations() {
alterTimestamps();
alternationInterval = setInterval(alterTimestamps, 5000);
})();
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment