Skip to content

Instantly share code, notes, and snippets.

@justinkahrs
Created August 29, 2023 18:38
Show Gist options
  • Save justinkahrs/377e2289c26315dc4b48c0fe450f8ed5 to your computer and use it in GitHub Desktop.
Save justinkahrs/377e2289c26315dc4b48c0fe450f8ed5 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Github relative-time
// @namespace http://tampermonkey.net/
// @version 0.1
// @description github returns datetimes instead of vague descriptions
// @author Justin Kahrs
// @match https://github.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// ==/UserScript==
function relativeTime() {
document.querySelectorAll("relative-time").forEach(function(el) {
var parent = el.parentNode;
var timestamp = el.title;
var span = document.createElement("span");
span.innerHTML = timestamp;
parent.removeChild(el);
parent.appendChild(span);
});
}
document.addEventListener('DOMNodeInserted', relativeTime, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment