Mat*_* S. 273
将鼠标悬停在上面2 years ago,您将获得时间戳.
尽管文本被一个<time>在其datetime属性下具有iso值的元素包裹,但是在"2年前"悬停时,真实日期并不适合我.
如果所有其他方法都失败了,就像它对我一样,请尝试检查文本.
样本元素:
<time datetime="2015-01-22T20:48:13Z" is="relative-time" title="Jan 22, 2015, 2:48 PM CST">7 days ago</time>
你可以只使用这个js书签:
javascript:(function() {
var relativeTimeElements = window.document.querySelectorAll("relative time");
relativeTimeElements.forEach(function(timeElement){
timeElement.innerHTML = timeElement.innerHTML +" -- "+ timeElement.title;
})
}()
)
Run Code Online (Sandbox Code Playgroud)
https://gist.github.com/PhilippGrulich/7051832b344d4cbd30fbfd68524baa38
它添加了正确的时间:像这样:21 小时前提交 - 2017 年 2 月 15 日,MEZ 15:49
我在 Chrome 上尝试了 @odony 的 TamperMonkey/Greasemonkey 脚本,但无法让它工作。detachCallback()没有被认可。因此,我没有分离任何回调,而是简单地替换了<relative-time>节点。
// ==UserScript==
// @name Github: always show absolute times
// @match https://github.com/*
// ==/UserScript==
(function() {
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);
});
})();
Run Code Online (Sandbox Code Playgroud)
抱歉,我没有用其他浏览器测试过这个,但由于这是基本的 javascript,它应该可以工作。:)
2021 年更新:小书签仍然是 GitHub 上的唯一选项。
\n例如,请参阅Justin Noel的“在 GitHub 中显示真实提交时间”
javascript:(function() { \n var style = document.createElement(\'style\');\n document.head.appendChild(style);\n var sheet = style.sheet;\n sheet.addRule(\'time-ago:before,relative-time:before\', \'content: attr(title);display: block;font-size: 0.5rem;\'); \n})()\nRun Code Online (Sandbox Code Playgroud)\n\n这与GitLab 14.1(2021 年 7 月)形成对比
\n\n\n用户设置显示绝对时间
\nGitLab 在很多地方显示相对时间(例如 30 分钟前)。
\n您现在可以更改用户配置文件首选项以显示绝对时间,例如 \xe2\x80\x98
\nMay 18, 2021, 3:57 PM\xe2\x80\x99。绝对时间尊重您的浏览器设置,并根据您首选的区域设置设置日期和时间的格式,例如英国英语而不是美国英语。
\n这个新的显示选项为需要工作流程(例如将 GitLab 中的操作与外部系统关联)的用户提供了更多信息,一目了然。
\n\n\n
| 归档时间: |
|
| 查看次数: |
40799 次 |
| 最近记录: |