Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

userscript support throd

Name: aeosynth !zdxFBW2hCw 2010-02-14 21:28

instead of registering on us.o just to make one post, you can use this thread. questions, comments, feature requests, patches are all fine.

I'll provide support for everything listed at http://userscripts.org/users/64431/scripts.

Name: aeosynth !zdxFBW2hCw 2010-02-23 5:11

>>40
wow that's some ugly code. try this:
// ==UserScript==
// @name           dis.4chan.org filter
// @namespace      aeosynth
// @include        http://dis.4chan.org/*;
// ==/UserScript==

var comments = /comment1|comment2/i;
var names = /name1|name2/i;
var subjects = /subject1|subject2/i;
var years = /200[4-8]/;

//utility
function $$(selector) {
  return document.body.querySelectorAll(selector);
}
function x(xpath, root) {
  return document
    .evaluate(xpath, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null)
    .singleNodeValue;
}
//funk(s)
function filter(regex, nodes, className) {
  for (var i = 0, l = nodes.length; i < l; i++) {
    if (regex.test(nodes[i].textContent)) {
      x('ancestor::div[starts-with(@class, "' + className + '")]', nodes[i])
        .style.display = 'none';
    }
  }
}
//main
filter(comments, $$('blockquote'), 'post');
filter(names, $$('span.postername'), 'post');
filter(subjects, $$('span.replies + a'), 'border');
filter(years, $$('span.posterdate'), 'border');

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List