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-05-24 20:21

hm, reposting >>41 since the semicolon on the @include line is giving me errors.

// ==UserScript==
// @name           dis.4chan.org filter
// @namespace      aeosynth
// @include        http://dis.4chan.org/*;
// @version        0.0.1
// @copyright      2010, James Campos
// @license        WTFPL; http://sam.zoy.org/wtfpl/
// ==/UserScript==

/* This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. */

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');


do you want me to post this on us.o and maintain it? I still don't see why an end-user would want this instead of the gui filter.

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