dpriskorn / Hide products out of stock from my.shimano-eu.com

// ==UserScript==
// @name        Hide products out of stock from my.shimano-eu.com
// @namespace   Violentmonkey Scripts
// @match       https://my.shimano-eu.com/sv/login/catalogue/*
// @grant       none
// @version     1.0
// @author      Dennis Priskorn
// @require     https://code.jquery.com/jquery-3.2.1.min.js
// @description 6/29/2021, 12:32:14 AM
// @license      GPL-3.0-or-later
// @copyright    2021, dpriskorn (https://openuserjs.org/users/dpriskorn)
// ==/UserScript==
(function() {
    'use strict';
    console.log("userscript is running")
    var rows = $(".result-list > ul:nth-child(2)").children()
    $( rows ).each(function(index){
        //console.log( index + ": " + $( this ).find(".product-name").children("span").text() );
        //console.log($(this))
        var outOfStock = $( this ).find("span.out-of-stock")
        var inStock = $( this ).find("span.in-stock")
        if ($(outOfStock).length > 0){
            console.log("found a product to be hidden");
            //console.log(outOfStock)
            $( this ).hide();
        }
        if ($(inStock).length > 0){
            console.log("found a product in stock");
            //console.log(inOfStock)
            //$( this ).hide();
        }
    })
})();