ghost4luck / Steam small tweaks

// ==UserScript==
// @name         Steam small tweaks
// @namespace    https://openuserjs.org/users/ghost4luck
// @version      0.2.3
// @description  small tweaks for steam website
// @author       ghost4luck
// @copyright    2018, ghost4luck (https://openuserjs.org/users/ghost4luck)
// @license      MIT
// @include      *store.steampowered.com*
// @icon         http://store.steampowered.com/favicon.ico
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
    // do not run in frames
    if (window.self != window.top) return;

    if (window.location.pathname.startsWith('/wishlist/')) {
        removeWishlistTags();
    } else {
        // remove all flyout content
        $J('#store_nav_area .store_nav > div.flyout_tab_flyout').remove();
        // remove flyout class (used to show flyout content)
        $J('#store_nav_area .store_nav > div.flyout_tab').removeClass('flyout_tab');
        // remove pulldown chevrones
        $J('#store_nav_area .store_nav span.pulldown').removeClass('pulldown');
        // remove curators recomendation
        $J('.steam_curators_ctn.home_ctn').remove();
    }
})(window);

function removeWishlistTags() {
    let wishlistItemCount = parseInt(document.getElementById('wishlist_item_count_value').textContent);
    let removedTags = 0;

    const observer = new MutationObserver(mutations => {
        if (removedTags === wishlistItemCount) {
            observer.disconnect();
            console.log('All tags removed, observer disconected.');
        }
        mutations.forEach(mutation => {
            if (mutation.addedNodes && mutation.addedNodes.length > 0) {
                for (let i = 0; i < mutation.addedNodes.length; i++) {
                    if (i === 0 && g_Wishlist && typeof g_Wishlist.SetViewMode === 'function') {
                        g_Wishlist.SetViewMode('compact', null);
                    }
                    const newNode = mutation.addedNodes[i];
                    let tags = $J(newNode).find('.tags');
                    let count = tags.length;
                    if (count > 0) {
                        tags.remove();
                        removedTags += count;
                    }
                }
            }
        });
    });

    observer.observe(document.getElementById('wishlist_ctn'), { childList: true });
}