V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
shendaowu

屏蔽 V2EX 的有新回复链接颜色变回去的功能的 javascript 书签,不知道这么小的东西发在这里够不够格

  •  
  •   shendaowu · Dec 22, 2019 · 3215 views
    This topic created in 2318 days ago, the information mentioned may be changed or developed.
    javascript:$(".topic-link").toArray().forEach(function(item, index){str = item.href; str = str.replace(/#.*$/,""); item.href = str;})

    顺便帮看看有没有什么我没发现的 BUG。

    平时基本只看奇思妙想,看过楼主发的内容基本就不想看回复了。本来访问过变色的功能挺不错的,结果 V2EX 有个有新回复链接颜色就会变回去的机制。
    Supplement 1  ·  Dec 23, 2019
    javascript:$(".topic-link").toArray().forEach(function(item){var str = item.href; str = str.replace(/#.*$/,""); item.href = str;})

    添加了定义变量的关键字 str。去掉了没有使用的参数 index。
    zhw2590582
        1
    zhw2590582  
       Dec 22, 2019   ❤️ 1
    强迫症告诉我 str 怎么不用 var 声明一下
    iamverylovely
        2
    iamverylovely  
       Dec 22, 2019
    $("a").css('color','');
    /*这样写行吗?*/
    shendaowu
        3
    shendaowu  
    OP
       Dec 23, 2019
    @zhw2590582 我也有点强迫症,时间长没用 javascript 忘了。修改过的加到附言里了。

    @iamverylovely 我试了你的方法,好像不行。你误解了我说的东西了吧?不过我也确实没怎么说明白。我说的是那个访问过的颜色和为访问过的颜色。a:visited 的那个。这有几个相关的帖子:
    /t/583548
    /t/456149
    i0error
        4
    i0error  
       Dec 23, 2019
    啊原来帖子链接末尾的 reply+数字是这个作用......优秀的思路
    no1xsyzy
        5
    no1xsyzy  
       Dec 23, 2019   ❤️ 1
    Tampermonkey,请,甚至不需要手动每次点书签

    另外,CSS 可以 a.topic-link:visited{color: #4d5256 !important;}
    但与特殊版式互不兼容。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3761 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 04:41 · PVG 12:41 · LAX 21:41 · JFK 00:41
    ♥ Do have faith in what you're doing.