Reddit Refresher Javascript Bookmark

Note: This is only compatible with the good old.reddit.com website!

javascript:(function(){
function w() {
  document.title = (document.title+" . [*]");
  var y = Math.random(), x = new XMLHttpRequest();
  x.onload = function() {
    var c = 0, d = document.createElement("div");
    d.innerHTML = this.responseText;
    var l = d.getElementsByClassName("thing");
    for (var i=(l.length-1); i>=0; --i) {
      var p = (l[i].getAttribute("data-permalink") + "");
      if (!p.startsWith("/r/")) { continue; }
      var f = 0, z = [null, null]; c = 0;
      var m = document.getElementsByClassName("thing");
      for (var j=0; j<m.length; ++j) {
        var q = (m[j].getAttribute("data-permalink") + "");
        if (!q.startsWith("/r/")) { continue; }
        if (q == p) { f = 1; }
        if (!z[0]) { z[0] = m[j]; }
        c += 1; z[1] = m[j];
      }
      if (c > (36-(parseInt(y*5)+1))) {
        z[1].parentNode.removeChild(z[1]);
      }
      if (f == 0) {
        console.log(p);
        z[0].parentNode.insertBefore(l[i], z[0]);
      }
    }
    var a = (new Date() + "").replace(/[ ]*[^ ]*-.*$/, "");
    var h = ("<b><font color='red'>" + a + "</font></b> &nbsp; &nbsp; pop in: ");
    document.getElementsByClassName("menuarea")[0].getElementsByTagName("span")[0].innerHTML = h;
    document.title = ("("+c+") . reddit");
  };
  var s="?", r=location.href;
  if (r.includes("?")) { s="&"; }
  x.open("GET", r+s+"r="+y);
  x.send();
}
w(); setInterval(w, ((9 * 60) + 1) * 1000);
})();

One thought on “Reddit Refresher Javascript Bookmark

Leave a reply to Links 9/10/2021: Wine 6.19 and Istio 1.9.9 | Techrights Cancel reply