Created
August 29, 2023 18:38
-
-
Save justinkahrs/377e2289c26315dc4b48c0fe450f8ed5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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