How to hide certain elements using Greasemonkey?

后端 未结 1 1599
遥遥无期
遥遥无期 2020-12-10 20:13

I\'m looking to hide certain elements using Greasemonkey. Links like this:

View

        
相关标签:
1条回答
  • 2020-12-10 21:04

    To hide all manner of Google Circles links (or images), use a Greasemonkey/Tampermonkey script like this:

    // ==UserScript==
    // @name     _Hide annoying links
    // @include  http://YOUR_SERVER.COM/YOUR_PATH/*
    // @require  http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
    // @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
    // @grant    GM_addStyle
    // ==/UserScript==
    /*- The @grant directive is needed to work around a design change
        introduced in GM 1.0.   It restores the sandbox.
    */
    waitForKeyElements (
        "a[href*='earn-google-circles'], img[src*='earn-google-circles']",
        hideNode
    );
    
    function hideNode (jNode) {
        jNode.hide ();
    }
    

    This gets both static and AJAX-loaded instances.

    See Choosing and activating the right controls on an AJAX-driven site for tips on choosing a jQuery selector.

    Reference:

    • jQuery selectors
    • waitForKeyElements()
    • jQuery hide()
    0 讨论(0)
提交回复
热议问题