wang867gmail.com / rarbg last post

// ==UserScript==
// @name        rarbg last post
// @namespace   
// @include   https://rarbg.com/torrents.php*
// @include   https://rarbg.to/torrents.php*
// @description show rarbg last post
// @version     1.2.6
// @grant       none
// ==/UserScript==
// 

var as=document.getElementsByTagName("td"), i=0, td;
var ad=document.getElementsByTagName("a"), j=0, a;
var pattern_dt = /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/;
var pattern_ad = /_adpub\.php/;

//find the last 2day
while (as[i]){
  td = as[i];
 if (td.textContent.match(pattern_dt)) {
    var d_o = new Date(td.textContent.replace(/-/g,"/")).valueOf();
    var d_fix = new Date(); //TimeZone +1 to +8
    d_fix.setTime(d_o+1000*60*60*7);
    var d_now = new Date(); //now
    //1day yellow
    if((d_now-d_fix)/(60*60*1000*24)<1){
      td.parentNode.style.backgroundColor = "yellow";
    }
    //2day red
    else if ((d_now-d_fix)/(60*60*1000*24)<2){
      td.parentNode.style.backgroundColor = "red";
    }
  }
  i++;
}

//remove ad link
while (ad[j]){
  a = ad[j];
  //remove ad link
  if (a.href.match(pattern_ad)) {
    console.log("get!");
    p = a.parentNode.parentNode.parentNode;
    c = a.parentNode.parentNode;
    p.removeChild(c);
  }
  j++;
}