質問一覧からスパム投稿を削除(その場しのぎ)

  • /*
     * @title 質問一覧からスパム投稿を削除(その場しのぎ)
     * @description その場しのぎだけど、うっとおしすぎるので
     * @include http://*
     * @license MIT License
     * @require 
     * @javascript_url
     */
    (function(){
        if (/http:\/\/q\.hatena\.ne\.jp\/(touch\/)?list/.test(location.href)) {
            var RE_SPAM = /^[- a-zA-Z0-9\\\[\](){}<>:;"'`?=/_.,@!~\n]+…?$/;
            var selector;
            if (/\/touch\//.test(location.href)) {
                selector = "LI.list-question SPAN.question-content";
            } else {
                selector = "UL.list-question LI SPAN.question-content";
            }
            $(selector).each(function() {
                if (RE_SPAM.test(this.textContent)) {
                    this.parentNode.parentNode.style.display = "none";
                } else {
                    console.log(this.parentNode.parentNode.tagName);
                    console.log(this.textContent);
                }
            });
        }
    })();
    
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2014/11/03 17:17:27 - 2014-11-03
  2. 2014/11/03 16:49:55 - 2014-11-03