Github remove relative date stupidness

Removes relative date stamps on Github commits, and shows actual date/time created.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        Github remove relative date stupidness
// @description Removes relative date stamps on Github commits, and shows actual date/time created.
// @namespace   http://www.wilcoxd.com
// @include     https://github.com*
// @version     1
// @grant       none
// ==/UserScript==

// created: WD-rpw 03-25-2013

/*
	if you don't like this there are two other Greasemonkey scripts that do the
	same thing, although in a more complicated way:

	  1. http://userscripts.org/scripts/show/107649
	  2. http://userscripts.org/scripts/show/107649

*/

(function() {

	function parseDate(date) {
    	var m = /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z/.exec(date);
    	var tzOffset = new Date(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +m[6]).getTimezoneOffset();

    	return new Date(+m[1], +m[2] - 1, +m[3], +m[4], +m[5] - tzOffset, +m[6]);
	}
	function format(el) {
		$el = $(el);
		$el.removeAttr("is");
		var time = $el.attr('title')||$el.attr("datetime");
		var formatted = time + " UTC";
		var dateObj = parseDate(formatted);

		if (dateObj)
			formatted = dateObj.toLocaleString();

		$el.html( formatted );
	}

	function onDOMSubtreeModifiedHandler(e){
		var target = e.target;
		if(target.nodeType === 1 && /TIME/ig.test(target.nodeName)&&/ago/.test(target.innerHTML)) {
			format(target);
		}
	}
	$("time[is='relative-time']").each( function(index, el) {
		format(el);
	});

	document.addEventListener('DOMSubtreeModified', onDOMSubtreeModifiedHandler, false);
})();