Hello,

This script worked fine a few weeks ago and now no longer works.

Can someone please help get it going for me?

Thanks a lot.

// ==UserScript==
// @name eBay - Hilight Items With Bids
// @namespace http://userscripts.org/users/126140
// @include http://.ebay./*
// @grant none
// @updateURL https://userscripts.org/scripts/source/66089.meta.js
// @downloadURL https://userscripts.org/scripts/source/66089.user.js
// @version 2.2.1
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
// @description Hilights items that have bids with a red border and yellow background.
// ==/UserScript==

$('document').ready(function() {
$(".bids").each(function() {
var text = $(this).text();
var regExp = /[0-9]+.(b|B)ids?/;

    if (regExp.test(text)) {
        var match = regExp.exec(text);
        var sNumBids = match[0].split(" ",1);
        var numBids = parseInt(sNumBids, 10);
        if(numBids > 0) {
            $(this).closest('table').css("border","3px solid red");
            $(this).closest('table').css("background-color","yellow");
        }
    }
});

});

Change the two lines starting with $(this).closest(...
Replace them with this:
$(this).closest('li.li').css({"border":"3px solid red","background-color":"yellow"})

$('document').ready(function() {
    $(".bids").each(function() {
        var text = $(this).text();
        var regExp = /[0-9]+.(b|B)ids?/;
        
        if (regExp.test(text)) {
            var match = regExp.exec(text);
            var sNumBids = match[0].split(" ",1);
            var numBids = parseInt(sNumBids, 10);
            if(numBids > 0) {
            //	$(this).closest('li.li').css("border","3px solid red, background-color":"yellow"});
                $(this).closest('li.li').css("border","3px solid red");
                $(this).closest('li.li').css("background-color,"yellow");
            }
        }
    });

});

Re: @Computerexpert:
One issue is: there is a typo (missing closing quotation mark on the property name) in this line:

$(this).closest('li.li').css("background-color,"yellow");

My initial solution only worked for some search results.
It seems like ebay now has different ways of listing articles. I found three but there might be more.

$('document').ready(function() {
    $(".bids span").each(function() {
        $this = $(this);
        var text = $this.text();
        var regExp = /([0-9]+)\s+(b|B)ids?/;
        if (regExp.test(text)) {
            var match = regExp.exec(text);
            var numBids = parseInt(match[1], 10);
            if(numBids > 0) {
                $this.closest('li.con-rst').css({"border":"3px solid red","background-color":"yellow"}); // Regular listing of articles
                $this.closest('li.li').css({"border":"3px solid red","background-color":"yellow"});  // Some search results are not shown in the above "regular" way
                $this.closest('div.box.mitem').css({"border":"3px solid red","background-color":"yellow"}); // Tiled search results
            }
        }
    });
});```

I successfully tested this with Firefox/Greasemonkey and Chrome/Tampermonkey (latest stable release for all) on ebay.com

Hey Cuzi - any idea on how to make it work once I click the 2nd page on eBay?

It seems as though it will work on the first run, but if I click page 2 for more results it doesn't work for some reason.

Re: @Computerexpert:
Could you post a URL where it happens? I seems to work everywhere I try...

Anyway I found another error: you can change $(".bids span") back to $(".bids")

Actually it works when I click the link.

So the page navigation numbers at the bottom will not run the GM Script again. It seems that it will only run it once.

Re: @Computerexpert:
I see it now, it does not happen in Firefox though...

Tested it with Chrome, it seems to work (most of the time).

function highlightBids() {
  $(".bids").each(function() {
    $this = $(this);
    var text = $this.text();
    var regExp = /([0-9]+)\s+(b|B)ids?/;
    if (regExp.test(text)) {
      var match = regExp.exec(text);
      var numBids = parseInt(match[1], 10);
      if(numBids > 0) {
        $this.closest('li.con-rst').css({"border":"3px solid red","background-color":"yellow"}); // Regular listing of articles
        $this.closest('li.li').css({"border":"3px solid red","background-color":"yellow"});  // Some search results are not shown in the above "regular" way
        $this.closest('div.box.mitem').css({"border":"3px solid red","background-color":"yellow"}); // Tiled search results
      }
    }
  });
}

var window_history_pushState = window.history.pushState;
window.history.pushState = function () {
  window_history_pushState.apply(window.history, arguments);
  window.setTimeout(highlightBids, 0);
}

$(window).bind('popstate' ,function() {
  window.setTimeout(highlightBids, 1000);
});

highlightBids();

Re: @Computerexpert:

Cuzi - I found one more problem that I can't figure out.

When I got to the front page of eBay it disables some photos for some reason.

I have disabled all GM scripts including this one. I then just added my script back in, but it still happens.

See photo below:

enter image description here

Re: @Computerexpert:
I am guessing the script uses another jquery version than ebay, which gets injected into the page and breaks the page - but I am not sure.
Anyway, just replace // @grant none with // @grant unsafeWindow.
This forces Greasemonkey to execute the script in a sandbox and prevents it from breaking the page's javascript.

Re: @Computerexpert:
Try this, it seemed to work but I didn't have time to test it thoroughly:

(function() {
  
  var highlightBids = function() {
    
    $(".lvformat").each(function() {
      $this = $(this);
      var text = $this.text();
      var regExp = /([0-9]+)\s+(b|B)ids?/;
      if (regExp.test(text)) {
        var match = regExp.exec(text);
        var numBids = parseInt(match[1], 10);
        if(numBids > 0) {
          $this.closest('li.con-rst').css({"border":"3px solid red","background-color":"yellow"}); // Regular listing of articles
          $this.closest('li.li').css({"border":"3px solid red","background-color":"yellow"});  // Some search results are not shown in the above "regular" way
          $this.closest('div.box.mitem').css({"border":"3px solid red","background-color":"yellow"}); // Tiled search results
        }
      }
    });
  }
  
  var window_history_pushState = window.history.pushState;
  window.history.pushState = function () {
    window_history_pushState.apply(window.history, arguments);
    window.setTimeout(highlightBids, 0);
  }
  
  $(window).bind('popstate', function() {
    window.setTimeout(highlightBids, 1000);
  });
  
  highlightBids();
  
})();

Actually the code may be fine. I tested it on a different browser. It just doesn't work with Greasemokey for some reason.