Jan. 20th, 2015

elfs: (Default)

I’m sure a lot of people need this, but not many would write it.  This is a tampermonkey script (tampermonkey is like greasemonkey, only for Chrome); Tampermonkey is an extension that lets you modify pages on the fly as they’re coming back from a server using Javascript.  Tokyo Tosho is my favorite torrent site for scanlated manga and anime, but they have a bit of a problem: they have no way to filter out anything on the list that isn’t seeded (i.e. isn’t really available).


The script below is a Tampermonkey script, raw.  What it does is fairly obvious: it finds the “Seeds: 0″ token and filters out any entries in which that appears.  TokyoTosho’s layout is a bit old-school, so it took some fiddling but it works, and it saves me a bit of time.


Use at your own risk.


function seedless() {   
  var stats = document.querySelectorAll('.stats');
  var lines = [];
  for(var i = 0, l = stats.length; i < l; ++i) { 
    lines.push(stats.item(i)); 
  }
  
  lines = lines
    .map(function(a) { 
      return [a, a.innerText.match(/S\:\s+(\d+)/)]; })
    .filter(function(a) { 
      return (parseInt(a[1][1], 10) == 0); })
    .forEach(
      function(a) { 
        var p = a[0].parentElement;
        p.previousSibling.style.display = 'none';
        p.style.display = 'none';
      });
}

setTimeout(seedless, 500);
elfs: (Default)

Following up on Seedless, I present Adless: a Tampermonkey extension that looks for the [Dismiss] button on your Twitter feed’s promoted items and pushes it for you:


function adless() {
  var stats = document.querySelectorAll('.dismiss-promoted');
  var lines = [];
  for(var i = 0, l = stats.length; i < l; ++i) { 
    lines.push(stats.item(i)); 
  }
       
  lines.forEach(function(a) {
    var e = document.createEvent("MouseEvents");
    e.initEvent('click', true, true);
    a.dispatchEvent(e);
  });
    
  setTimeout(adless, 1000);
}

setTimeout(adless, 500);

Profile

elfs: (Default)
Elf Sternberg

May 2025

S M T W T F S
    123
45678910
111213141516 17
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 11th, 2025 03:57 am
Powered by Dreamwidth Studios