Ebay Collection only filter v2 fixed

Hide collection only listings

// ==UserScript==
// @name       Ebay Collection only filter v2 fixed
// @namespace  CollectionOnlyFilter
// @version    2
// @description  Hide collection only listings
// @include      https://www.ebay.co.uk/*
// ==/UserScript==

//span.s-item__localDelivery



var search_items = ["span.ship" , "span.s-item__localDelivery" , "span.s-item__deliveryOptions" , "span.s-item__localDelivery" ];

for (z = 0; z < search_items.length; z++) 
{ 
  //alert("valid "+z + "  " +search_items[z]);
  var elements = document.body.querySelectorAll(search_items[z]); 

  for (var i = 0; i < elements.length; i++) 
  {
    if(elements[i].innerHTML.search(/Collection only: Free|Free collection in person|Collection in person/) != -1)
    {
      //elements[i].parentElement.parentElement.parentElement.parentElement.parentElement.style.display = "none";
      elements[i].parentElement.parentElement.parentElement.style.display = "none";
      elements[i].parentElement.parentElement.parentElement.parentElement.parentElement.remove ();
    }
  }
}