@
hanxiV2EX 修正了一下:
// ==UserScript==
// @
name Github Time Replace
// @
namespace http://tampermonkey.net/// @
version 0.1
// @
description try to take over the world!
// @
author You
// @
match https://github.com/*// @
icon https://www.google.com/s2/favicons?domain=github.com// @
grant none
// ==/UserScript==
(function () {
'use strict';
function replaceTime(){
const items = document.getElementsByTagName("relative-time")
for (let i = 0; i < items.length; i++) {
const item = items[i];
item.innerHTML = item.title.replace(/GMT.*$/,'')
}
}
replaceTime();
var observer = new MutationObserver(function (mutations, observer) {
replaceTime();
});
var body = document.querySelector('body');
var options = { 'childList': true };
observer.observe(body, options);
})();