Tampermonkey hide post title script

Sometimes I eat fish and eat melons on some community forums, but some good family members come up with titles that really make people die.
So I am going to write a small script by myself with the help of TamperMonkey, which is the oil monkey, so that I can be more calm when reading Hupu posts. .
I have written a version before, which can also reduce the pictures in the comment area of ​​Hupu posts, but it was written on the previous computer, and the script has not been synchronized, so I can only rewrite it this time.
This time I wrote one based on mouse scrolling monitoring. Already tested and available. Here is mainly to make a record.

1. Tiger pounces on the title

// ==UserScript==
// @name         虎扑标题隐藏-监听鼠标版
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  隐藏帖子标题
// @author       You
// @match        *://bbs.hupu.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    
    
    'use strict';
    window.addEventListener("scroll", handleScroll, true); //监听滚动事件

    function handleScroll() {
    
    
        var elements = document.getElementsByClassName('post-fix-title-title');
        for (var i = 0; i < elements.length; i++) {
    
    
            elements[i].style.display = 'none';
        }
    }
})();

The previous version was waitForKeyElementsrealized by using , and I will add it when I find it later.

2. Zhihu goes to the title

// ==UserScript==
// @name         知乎标题隐藏-监听鼠标事件版
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  知乎标题隐藏
// @author       You
// @match        *://www.zhihu.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=zhihu.com
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    
    
    'use strict';
    window.addEventListener("scroll", handleScroll, true); //监听滚动事件

    function handleScroll() {
    
    
        var elements = document.getElementsByClassName('QuestionHeader-title');
        for (var i = 0; i < elements.length; i++) {
    
    
            elements[i].style.display = 'none';
        }
    }
    //
})();

3. References

https://www.yisu.com/zixun/543039.html
http://www.mobiletrain.org/about/BBS/119969.html
https://blog.csdn.net/weixin_40425415/article/details/120561482
https://www.cnblogs.com/ConfidentLiu/p/7815624.html

Guess you like

Origin blog.csdn.net/sdujava2011/article/details/131340453