A script to nuke entries in /v/all/new from a particular sub I want to ignore (i.e. client-side ignore)

14    06 May 2015 14:51 by u/Genghis_Khan

I started whipping up some JavaScript to iterate though the list in /v/all/new and delete the elements from a matching sub. This is mostly copy-pasta from a few Google searches. Unfortunately, I am not a JS expert and have run out of time (for now). Currently, the script matches and deletes the first entry, then hits and error and stops. If anyone wants to pick this up and debug it, I'm sure a lot of people would appreciate it.

//Toss all the anchors into an array
var els = document.getElementsByTagName("a");
//Iterate through them
for (var i = 0, l = els.length; i < l; i++) 
{
    var el = els[i];
    //Find the matching sub in the anchor
    if (el.href === 'https://voat.co/v/SubToDelete')
    {
        //Kill it
        delete_row(el);
    }
}
//Kill function
function delete_row(e)
{
    e.parentNode.parentNode.parentNode.parentNode.removeChild(e.parentNode.parentNode.parentNode);
}

7 comments

1

very nice

-1

Its guys like u that keep us pushing!