Need a little help with my Javascript/Reg Ex - eBay

Discussion in 'JavaScript' started by primster7, Jul 5, 2017.

  1. #1
    I need a little help with my code.

    This stopped working on eBay just recently. It worked around 2 weeks ago. Can anyone please help and find the code that needs to be edited?


    • (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
    • }
    • if(numBids >5){
    • $this.closest('li.con-rst').css({"border":"3px solid red","background-color":"lime"});// Regular listing of articles
    • $this.closest('li.li').css({"border":"3px solid red","background-color":"lime"});// Some search results are not shown in the above "regular" way
    • $this.closest('div.box.mitem').css({"border":"3px solid red","background-color":"lime"});// Tiled search results
    • }
    • if(numBids >10){
    • $this.closest('li.con-rst').css({"border":"3px solid red","background-color":"grey"});// Regular listing of articles
    • $this.closest('li.li').css({"border":"3px solid red","background-color":"grey"});// Some search results are not shown in the above "regular" way
    • $this.closest('div.box.mitem').css({"border":"3px solid red","background-color":"grey"});// 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();
    • })();
     
    primster7, Jul 5, 2017 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    What, exactly, is not working? Create breakpoints, and log to console to see where it stops responding. Error-messages in the console? And please, for everything that is holy, learn to use the editor before posting massive bouts of code - [ code] code goes here [/ code] (without the spaces, of course)
     
    PoPSiCLe, Jul 8, 2017 IP
  3. primster7

    primster7 Well-Known Member

    Messages:
    801
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    110
    #3
    I fixed it please delete.
     
    primster7, Jul 8, 2017 IP