Skip to content

Instantly share code, notes, and snippets.

@byron70
Created April 17, 2020 18:41
Show Gist options
  • Save byron70/42b3a1849468626f025439642b0cfa3d to your computer and use it in GitHub Desktop.
Save byron70/42b3a1849468626f025439642b0cfa3d to your computer and use it in GitHub Desktop.
gitlab convert relative times to absolute
// ==UserScript==
// @name GitLab Local Time
// @namespace http://tampermonkey.net/
// @version 0.1.0
// @description Show time instead of relative time in UI
// @author Byron Mann
// @match https://yourdomain.gitlab.domain.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function gitlabTime() {
const timeElementList = Array.from(document.getElementsByTagName('time'));
timeElementList.forEach(function(elem) {
console.log(elem.getAttribute('title'));
if (elem.getAttribute('title')) {
elem.innerHTML = elem.getAttribute('title');
}
if (elem.getAttribute('data-original-title')) {
elem.innerHTML = elem.getAttribute('data-original-title');
}
});
setTimeout(() => {
gitlabTime();
}, 2000)
}
setTimeout(() => {
gitlabTime();
}, 1000)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment