IsThereAnyDeal / AugmentedSteam

Augments your Steam Experience
https://augmentedsteam.com
GNU General Public License v3.0
1.39k stars 86 forks source link

Apply highlighting to ds_options action #532

Open Revadike opened 5 years ago

Revadike commented 5 years ago

image image

Ignoring or wishlisting an app this way doesn't apply Augmented Steam's own highlighting. I'm thinking... a great solution would be to make ignore/owned/wishlist highlighting (mostly) css only feature. As steam already highlights these already.

Revadike commented 4 years ago

Okay, so I attempted to do this. This seems to be the best way to detect if a game was ignored/added to wishlist:

    let node = null;
    document.addEventListener("click", function(e) {
        node = e.target.closest(".ds_options");    
    });

    let observer = new MutationObserver(function(mutation_records) {
        let tooltip = document.querySelector(".ds_options_tooltip");
        if (!tooltip || !node) { return; }

        tooltip.addEventListener("mousedown", function() {
            Highlights.highlightAndTag([node.parentNode]);
        });
    });
    observer.observe(document.body, { 'childList': true, });

However, the problem is that the highlightAndTag function isn't designed to handle nodes that have been highlighted and tagged before. So, for example, if you wishlist a game, it stays highlighted as wishlist.

There may be some overlap with https://github.com/tfedor/AugmentedSteam/issues/375, in the sense that the web page content is dynamic and may need to be augmented again.