Trying to target specific blurbs of code, help appreciated. ^_^

Howdy all,

(Sorry if this has been asked before, have been trying to search the forums/styles and haven't seen much that matches my conundrum.)

I used to use Stylish many moons ago in another browser, wrote some custom scripts to spruce up Raptr and other sites, was awesome.

I recently started using Stylish again, and it's scary how much I've forgotten about how to write Stylish scripts. I've been digging through the help files, and I "semi" think I get what I'm looking for, but just can't seem to wrap my head around it.

So to give a better idea, will explain what I'm trying to do...

For any that use Steam or play Steam games, you probably have noticed that on the steamcommunity forums there is no way to filter/block/ignore forum-posts from certain users, no matter how toxic, childish, hateful, venomous, etc. (Which becomes a problem when the devs are asking for feedback, and you give feedback about the game, that even while some others might agree with, there's usually those toxic-factions that are completely opposed, and rather than state their opinion on the matter, choose instead to make it personal, ridicule you, get their friends involved to dog-pile you, etc.)

What I'm aiming to do, and have tried a couple different extensions as well as attempted making custom AdBlock rules to do it (but I still think Stylish is my best shot)... is have a check for the user's URL (the link on their username on their forum post), if their URL is found (example: https://steamcommunity.com/id/username), I'm trying to get the surrounding DIV for the entire post, of class "commentthread_commentresponsive_body_text" that contains said URL, to be removed/hidden.

Is this possible? Could anybody spare some tips or point me in the right direction of either other scripts that do something similar I can get an idea from, or samples that might allow this to work?

Any help is GREATLY appreciated, thanks in advance! :)

Comments

  • edited August 2015 Chrome
    Just to clarify, not looking to do anything fancy... fully plan to re-edit as time goes on, to add new users as time goes on, on different lines... just hoping to strike a format that works, so I can copy/paste the code and merely change the user URL to have the same effect.

    The goal is to act as an ignore/block list, so no matter what other game/community pages they post in, I will be unable to see what they're saying.
  • This cannot be done via CSS as the has selector isn't yet implemented.

    Try installing this userscript (after installing Tampermonkey extension). If it won't work try contacting the userscript's author or ask on https://greasyfork.org/en/forum/

  • edited August 2015 Chrome
    Sweet, thanks for the info. Much appreciated. ^_^

    Thankfully I already have TamperMonkey installed, so hoping this will work rather smoothly. :)

    EDIT: May look at tweaking it up a bit, looks like the script is for banning users... guessing one would need moderator or above powers. *scratches head*
  • Yep, completely irrelevant. Basically, you want to find a bad guy's comment, find the outermost container of the comment, and mark it with a class name, then apply a style sheet to adulterate the bad guy's comments. An example, using the display names:
    /* user script */
    var badGuys = ["Keyur Joshi", "Ryok."],
    badGuyClass = "badGuy";

    function Exterminate(elements, userName, containerClass) {
    Array.prototype.forEach.call(elements, function(element) {
    if (element.textContent === userName) {
    for ( ; !element.classList.contains(containerClass); element = element.parentNode) {}
    element.classList.add(badGuyClass);
    }
    });
    }

    badGuys.forEach(function(badGuy) {
    Exterminate(document.querySelectorAll('.commentthread_author_link bdi'),
    badGuy,
    "commentthread_comment");
    Exterminate(document.querySelectorAll('.bb_quoteauthor a'),
    badGuy,
    "bb_blockquote");
    });
    /* user style sheet */
    .badGuy {
    color: chartreuse !important;
    outline: thin solid chartreuse;
    }
    on https://steamcommunity.com/app/8870/discussions/0/527273452880200561/
  • edited August 2015 Chrome
    wOxxOm said:

    This cannot be done via CSS as the has selector isn't yet implemented.

    @wOxxOm, is this actually gonna happen any time soon?
  • edited August 2015 Safari

    @wOxxOm, is this actually gonna happen any time soon?

    Probably not gonna happen.
    It's a jQuery extension and not part of the CSS specification.
    It's not even on W3C working draft.

  • Sounded too good to be true, but he phrased it like it was in development. Had my hopes up for a minute. Thanks for clearing that up @LouCypher.
  • edited August 2015 Firefox
    LouCypher said:

    The subject selector ($a > b or a! > b or !a > b - the syntax was never settled) in the working draft of Selectors/4 has been replaced with the a:has(> b) pseudo-class in the editor's draft. I don't believe either has been implemented except as a polyfill.
    http://www.w3.org/TR/selectors4/#subject
    https://drafts.csswg.org/selectors-4/#relational
Sign In or Register to comment.