V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
unco020511
V2EX  ›  程序员

有没有一种 chrome 插件可以将页面日期自动格式化为 ISO_DATE

  •  
  •   unco020511 · 2021-11-10 10:59:37 +08:00 · 1601 次点击
    这是一个创建于 869 天前的主题,其中的信息可能已经有所发展或是发生改变。

    楼主的英文不太好,经常在github issue 看到#156 opened on 18 Aug by xxx这样的日期时没法第一时间确定到底是哪个月,要是有插件能自动格式化为标准的ISO_DATE就好了

    19 条回复    2021-11-10 17:39:17 +08:00
    hanxiV2EX
        1
    hanxiV2EX  
       2021-11-10 11:07:31 +08:00
    自己写一个猴游脚本?
    Vegetable
        2
    Vegetable  
       2021-11-10 11:11:28 +08:00   ❤️ 2
    一个一般性的设计:
    页面上的日期,尤其是 humanized 的日期,应该支持鼠标悬停显示原始日期。
    一个设计合理的网站都应该有这个功能,V2EX 也有,同样 GitHub 也有。不过这需要花点时间鼠标移上去。
    得益于 Github 的良好设计,可以通过这个油猴脚本轻松实现这个功能

    // ==UserScript==
    // @name New Userscript
    // @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';
    const items = document.getElementsByTagName("relative-time")
    for (let i = 0; i < items.length; i++) {
    const item = items[i];
    item.innerHTML = item.title
    }
    })();
    coolan
        3
    coolan  
       2021-11-10 11:23:29 +08:00
    就是楼上的,顺便可以去掉后面的时间,使用这个:item.innerHTML = item.title.replace(/GMT.*$/,'')
    hanxiV2EX
        4
    hanxiV2EX  
       2021-11-10 11:28:39 +08:00
    @Vegetable 试了下,刷新才有效,点击按钮切换过来的无效。
    coolan
        5
    coolan  
       2021-11-10 11:48:57 +08:00   ❤️ 1
    @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);

    })();
    Seayon
        6
    Seayon  
       2021-11-10 11:52:40 +08:00
    同,Stack Overflow 的日期每次要把光标悬浮上去看,打算督促自己学好英语解决。
    starsky007
        7
    starsky007  
       2021-11-10 12:17:56 +08:00
    @Seayon
    为 Stack Overflow 及 Stack Exchange 旗下网站启用 ISO 时间格式
    https://greasyfork.org/zh-CN/scripts/389674-iso-time-format-for-stackoverflow
    starsky007
        8
    starsky007  
       2021-11-10 12:21:44 +08:00   ❤️ 1
    @Vegetable
    @coolan
    有用,建议发布到 greasyfork 。最好把这个也整合起来:
    greasyfork.org/zh-CN/scripts/389674-iso-time-format-for-stackoverflow
    XiaoBaiYa
        9
    XiaoBaiYa  
       2021-11-10 12:24:08 +08:00 via Android
    虽然就 12 个月,我也一直记不住。记其它东西倒是很快
    kkocdko
        10
    kkocdko  
       2021-11-10 12:49:27 +08:00 via Android
    建议学好英语,解决一切问题
    unco020511
        11
    unco020511  
    OP
       2021-11-10 14:46:16 +08:00
    @coolan #5 可以可以,用上了,谢谢
    unco020511
        12
    unco020511  
    OP
       2021-11-10 14:47:37 +08:00
    @starsky007 #7 也加上了,谢谢
    unco020511
        13
    unco020511  
    OP
       2021-11-10 14:48:30 +08:00
    @kkocdko 哎,英语一直不太好
    2i2Re2PLMaDnghL
        14
    2i2Re2PLMaDnghL  
       2021-11-10 15:17:34 +08:00
    @kkocdko 也有转换的心智开销,因为平日里不是用三字母记当前是几月的。
    就好比正月 腊月,也要经过一次转换,难道我中文不好?(
    zhangchongjie
        15
    zhangchongjie  
       2021-11-10 16:17:05 +08:00
    随便写一个都可以,引入 jq 然后改吧
    coolan
        16
    coolan  
       2021-11-10 16:34:26 +08:00   ❤️ 3
    lvdb
        17
    lvdb  
       2021-11-10 16:54:00 +08:00
    月份英文全称和简写是英语的基础,初中开始学习英语的话,应该是初二的时候学的。
    zhanglintc
        18
    zhanglintc  
       2021-11-10 17:23:54 +08:00
    @Vegetable #2 原来网站还支持这个功能。。。才知道 😅
    SmiteChow
        19
    SmiteChow  
       2021-11-10 17:39:17 +08:00
    建议装一个 Google 翻译扩展,可以选词翻译
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1212 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 18:08 · PVG 02:08 · LAX 11:08 · JFK 14:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.