Coffeehouse Thread

11 posts

User css ignore list

Back to Forum: Coffeehouse
  • User profile image
    Bass

    I previously had an ignore list I maintained on the old C9 but it stopped working at some point.

    Any CSS gurus here know how to select posts on this new C9 by username in order to hide them? I looked at the source code and it does not seem to have any way to devise a simple selector for this, am I missing something?

  • User profile image
    cbae

    I know of a hotkey combination that turns on the ignore feature.

  • User profile image
    PaoloM

    It looks quite straightforward...

    This is how a post is composed in HTML:

    <div class="author">  <a class="button" href="/Niners/Bass"><img alt="Bass" class="avatar" src="http://files.channel9.msdn.com/avatar/2579358c-a8c8-49c9-881d-dda87a6f0eb6.jpg" title="Bass" /><span class="name">Bass</span></a>  <span class="caption">Because the people who are crazy enough to think they can change the world, are the ones who&#160;do.</span> </div>

    <div class="post" id="c65b1eb250218400cbedc9f7e00287d5e">  <div class="post-header">    <a class="quote button" href="/Forums/Coffeehouse/User-css-ignore-list#c65b1eb250218400cbedc9f7e00287d5e" title="Bass">quote</a>    <a class="add reply button" href="/Forums/Coffeehouse/User-css-ignore-list#c65b1eb250218400cbedc9f7e00287d5e" title="Bass">reply</a>   <a class="permalink" href="/Forums/Coffeehouse/User-css-ignore-list/65b1eb250218400cbedc9f7e00287d5e" title="Post Permalink">1 day&#160;ago</a>  </div>  <div class="post-content">   <p>I previously had an ignore list I maintained on the old C9 but it stopped working at some point.</p><p>Any CSS gurus here know how to select posts on this new C9 by username in order to hide them? I looked at the source code and it does not seem to have any way to devise a simple selector for this, am I missing something?</p>  </div>    <form class="spam" method="POST" action="/Forums/Coffeehouse/User-css-ignore-list/65b1eb250218400cbedc9f7e00287d5e/IsSpam">     <input type="submit" value="mark as spam" class="submit button"/>         </form> </div>

    if you select @class="author"/a/@title="Bass" you get the first div, from there it's trivial to select the following one and voila', job done.

     

  • User profile image
    PaoloM

    Or, even better, go to the parent one and hide the whole <li>!

  • User profile image
    ZippyV

    @PaoloM: Is that a CSS selector?

  • User profile image
    W3bbo

    The CSS equivalent is: .author[title="bass"] { display: none; }

  • User profile image
    Zeus

    @W3bbo: That actually would not work because the that would only hide the avatar image. There are no parent selectors in CSS, so this actually cannot be done with the current HTML. The C9 devs would have to add a user-name class to the li parent like this: <li class="bass"> ... </li>

  • User profile image
    TommyCarlier

    @Zeus: Adding the username as a class is a bad idea because the class is also used for the CSS. If you have a user whose username is "post" or "author", the style would be all messed up.

    However, adding the username as a data-attribute is a good idea and very HTML5-y:

    <li data-user="bass">…</li>

    Then you could have the following user CSS:

    #posts > li[data-user="bass"] { display: none; }

  • User profile image
    Zeus

    @TommyCarlier: of course ... maby I should use both brain cells before I comment Perplexed

  • User profile image
    TommyCarlier

    After I suggested using the data-attribute, the C9-devs have added the data-author attribute to each post.

    So, now you can remove posts from people you don't like via user CSS, like this:

    #posts > li[data-author="Bass"] { display: none; }

  • User profile image
    ZippyV

    or

    #posts > li[data-author~="beer"] { display: none; }

     

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.