Are you sure you want to go to an external site to donate a monetary value?
WARNING: Some countries laws may supersede the payment processors policy such as the GDPR and PayPal. While it is highly appreciated to donate, please check with your countries privacy and identity laws regarding privacy of information first. Use at your utmost discretion.
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"); } } });
});
Re: @Computerexpert:
Can't read your code properly dude. Try reposting with back apostrophes e.g code fences like mentioned here.
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: @cuzi:
Hi Cuzi - I tried your suggestion and it didn't work.
Do you have any other thoughts?
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");
Re: @jscher2000:
Thanks jscher2000, but it's still not highlighting for some reason.
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
Re: @cuzi:
Thanks a lot Cuzi - that worked perfect!
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")
Re: @cuzi:
If you go to just eBay.com and search for say dell laptop when I click the 2nd page at the bottom it doesn't highlight anything.
Example:
http://www.ebay.com/sch/i.html?_from=R40&_sacat=0&_sop=1&_nkw=dell+laptop&_pgn=2&_skc=200&rt=nc&ajxpg=1
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: @cuzi:
Thanks a lot Cuzi! - the new code seems to have fixed the 2nd page problem.
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:
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.
Thanks a lot Cuzi!
That worked perfect.
Cuzi - the eBay script is not highlighting again.
Can you please take a look for me?
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(); })();
Thanks a lot Cuzi - your script worked perfect!
Hi Cuzi,
The script broke a few weeks ago.
Can you please check eBay and see what happened?
Hi Cuzi,
Can you please look at the code again?
Something changed on eBay and it's broke now.
Actually the code may be fine. I tested it on a different browser. It just doesn't work with Greasemokey for some reason.