2016-01-27 30 views
1

我如何能夠阻止/隱藏用戶dbs所有帖子?用一個userscript?隱藏用戶與jQuery在用戶腳本中的文本

<article class="container"> 
    <div class="messages" id="messages"> 
    <div class="message info"> 
    <span class="nick"> 
    <a title="2016-01-27 16:27:48"> 
     * 
    </a> 
    </span> 
    <pre class="text">Users online: Hej</pre> 
    </div> 
    <div class="message info"> 
    <span class="nick"> 
    <a title="2016-01-27 16:27:58"> 
    * 
    </a> 
    </span> 
    <pre class="text">dbs joined</pre> 
    </div> 
    <div class="message"> 
    <span class="nick"> 
    <a title="2016-01-27 16:24:55"> 
    dbs 
    </a> 
    </span> 
    <pre class="text">Hej</pre> 
    </div> 
</div> 
</article> 

我知道,如果DBS更改暱稱,我再次得到的消息..

網站https://hack.chat/?lil和律是房間..

編輯:

我的計劃是像這樣的東西

// ==UserScript== 
// @name  HackChat 
// @namespace some 
// @description Hide unwanted user. 
// @include  https://hack.chat/* 
// @require  https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js 
// @version  1.0 
// @grant  GM_getValue 
// @grant  GM_setValue 
// @grant  GM_addStyle 
// ==/UserScript== 

/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts, 
that detects and handles AJAXed content. 

Usage example: 

    waitForKeyElements (
     "div.comments" 
     , commentCallbackFunction 
    ); 

    //--- Page-specific function to do what we want when the node is found. 
    function commentCallbackFunction (jNode) { 
     jNode.text ("This comment changed by waitForKeyElements()."); 
    } 

IMPORTANT: This function requires your script to have loaded jQuery. 
*/ 
var hiddenNick = $("article.container............").has ("dbs"); 

hiddenNick.hide(); 
+0

沒有人對此有任何答案? –

回答

1

使用jquery - >把你想要隱藏的東西放入一個帶有id的div中 - >在文檔加載或某個動作中(例如。鼠標懸停,點擊等...) - >調用hide();在div元素上。

<script type="text/javascript"> 
    // Either an action function or on document load... 
    $(".hideMe").hide(); 
</script> 

<div id="hideMe"> 
<!-- Some content --> 
</div> 
+1

對不起。但我想你誤會了我。因爲我要求用戶隱藏內容.. –