Greasy Fork

Greasy Fork is available in English.

SkipAntennaSite

アンテナサイトがうざい

当前为 2016-03-13 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        SkipAntennaSite
// @namespace   http://greasyfork.icu/ja/scripts/16465-skipantennasite
// @description アンテナサイトがうざい
// @version     1.9
// @license     MIT License
// @grant       none
// @include     http://2ch-c.net/*
// @include     http://get2ch.net/*
// @include     http://the-3rd.net/*
// @include     http://matomeantena.com/*
// @include     http://moudamepo.com/*
// @include     http://newmofu.doorblog.jp/*
// @include     http://newota.blog.fc2.com/*
// @include     http://newresu1.blog.fc2.com/*
// @include     http://newyaku.blog.fc2.com/*
// @include     http://newero1.blog.fc2.com/*
// @include     http://blog-news.doorblog.jp/*
// @include     http://nullpoantenna.com/*
// @include     http://newpuru.doorblog.jp/*
// @include     http://besttrendnews.net/*
// @include     http://2ch.logpo.jp/*
// @include     http://s.2ch.logpo.jp/*
// @include     http://anaguro.yanen.org/*
// @include     http://a.anipo.jp/*
// @include     http://katuru.com/*
// @include     http://news-choice.net/*
// @include     http://img.favsite.jp/*
// @include     http://wk-tk.net/*
// @include     http://newser.cc/*
// @include     http://kita-kore.com/*
// @include     http://2channeler.com/*
// @include     http://matomeja.jp/*
// @include     http://shimamurakun.net/*
// @include     http://kateich.net/*
// @include     http://2ch-2.net/*
// @include     http://2ch-n.net/*
// @include     http://nantuka.blog119.fc2.com/*
// @include     http://lifeantenna.com/*
// @include     http://giko-news.com/*
// @include     http://matome-surume.com/*
// @include     http://blog.livedoor.jp/houkagoguide/*
// @include     http://blog.livedoor.jp/ind_bikkuri/*
// @include     http://blog.livedoor.jp/hioaysdnhjlk/*
// @include     http://blog.livedoor.jp/warota_a_lot/*
// @include     http://blog.livedoor.jp/kijyonotsudoi/*
// @include     http://blog.livedoor.jp/magicalnews/*
// @include     http://blog.livedoor.jp/gndai/*
// @include     http://blog.livedoor.jp/tokusetsu_news/*
// @include     http://blog.livedoor.jp/xexnews/*
// @include     http://blog.livedoor.jp/navippu/*
// @include     http://watch2ch.2chblog.jp/*
// @include     http://2chfinder.com/*
// @include     http://gurugurulog.com/*
// @include     http://www.j-antenna.com/*
// @include     http://headline.mtfj.net/*
// @include     http://antennachan.com/*
// @include     http://www.ne.jp/asahi/*
// @include     http://matometatta-news.net/*
// @include     http://2ch-matome.com/*
// @include     http://tokkaban.com/*
// @include     http://owata.chann.net/*
// @include     http://newspickup.com/*
// @include     http://2ch-m.net/*
// @include     http://baseball-mag.net/*
// @include     http://new-soku.net/*
// @include     http://www.2ch-antenna.net/*
// @include     http://gikotena.net/*
// @include     http://matonet.info/*
// @include     http://minkurumato.net/*
// @include     http://news-three-stars.net/*
// @include     http://news-select.net/*
// @include     http://rss.harikonotora.net/*
// @include     http://vipsister.blog72.fc2.com/*
// @include     http://www.pantena.net/*
// @include     http://matomeume.com/*
// @include     http://matomesakura.com/*
// @include     http://matome-ch.com/*
// @include     http://0matome.com/*
// @include     http://www.2chantena.info/*
// @include     http://rotco.jp/*
// @include     http://uhouho2ch.com/*
// @include     http://afoafodayo.blog84.fc2.com/*
// @include     http://matomena.jp/*
// @include     http://nkijo.com/*
// @include     http://2ch-antenna.com/*
// @include     http://www.tukuruyoantena.com/*
// @include     http://www.まとめニュース.com/*
// @include     http://www.xn--o9j0bk8t7cqhlg.com/*
// @include     http://2chmatomeru.info/*
// @include     http://waniantenna.com/*
// @include     http://gossip2.net/*
// @include     http://kojikisokuhou.com/*
// @include     http://multi-media.doorblog.jp/*
// @include     http://blogtsurugi.blog38.fc2.com/*
// @include     http://konowaro.net/*
// @include     http://giko2ch.net/*
// @include     http://dariusnews.blog11.fc2.com/*
// @include     http://2ch-a.info/*
// @include     http://www.matomech.com/*
// @include     http://www.so9.jp/*
// @include     http://matonew.doorblog.jp/*
// @include     http://cawaii2ch.com/*
// @include     http://killing-time.biz/*
// @include     http://2ch-spot.com/*
// @include     http://o-2ch.net/*
// @include     http://jyouhouya3.net/*
// @include     http://www.sechigara.net/*
// @include     http://cyousokuvip.com/*
// @include     http://*.warotamaker.com/*
// @include     http://*.warotah.com/*
// @include     http://seiyuu-antena.antena-nijimatome.com/*
// @include     http://seiyuu.seiyuu-antenna.info/*
// @include     http://seiyuu.antena-matome-2ch.com/*
// @include     http://*.antenam.info/*
// @include     http://*.antenam.biz/*
// @include     http://*.antenam.jp/*
// @include     http://*.atna.jp/*
// @include     http://*.a-antenam.info/*
// @include     http://voice.lady.jp/*
// @include     http://koebuta.net/*
// @include     http://girlsreader.com/*
// @include     http://kuma-log.net/*
// @include     http://a-matome.com/*
// @include     http://antenna.gift/*
// @include     http://matomatome.com/*
// @include     http://www.antennash.com/*
// @include     http://antenna-ga.com/*
// @include     http://lifech.2-d.jp/*
// @include     http://katei-matome.com/*
// @include     http://news-pod.net/*
// @include     http://2chnavi.net/*
// @include     http://2ch.anything-navi.net/*
// @include     http://twobeko.com/*
// @include     http://girls-antena.2chblog.jp/*
// @include     http://*.readers.jp/*
// @include     http://webnew.net/*
// @include     http://geinou2news.blog.fc2.com/*
// @include     http://matomea.net/*
// @include     http://newsoku.jp/*
// @include     http://*.nantena.pw/*
// @include     http://oniyomediary.com/*
// @include     http://1000mg.sblo.jp/*
// @include     http://netaatoz.blog21.fc2.com/*
// @include     http://2ch-matome.net/*
// @include     http://koisoku.net/*
// @include     http://buromato.com/*
// @include     http://nyan.eggtree.net/*
// @include     http://ii-antenna.net/*
// @include     http://matome-alpha.com/*
// @include     http://fxmtm.net/*
// @include     http://merry-news.com/*
// @include     http://clipch.com/*
// @include     http://aube0.com/*
// @include     http://xnews.jp/*
// @include     http://nanj-of-us.main.jp/*
// @include     http://nanj-matome.com/*
// @include     http://yomyo.jp/*
// @include     http://365dys.com/*
// @include     http://sta-navi.net/*
// @include     http://moyashi.me/*
// @include     http://sp.2chmap.com/*
// @include     http://2chmap.com/*
// @include     http://antenna.shinobi.jp/*
// @include     http://trend-pr.com/*
// @include     http://uchitome.com/*
// @include     http://vipper774.blog115.fc2.com/*
// @include     http://2ch-matomato.com/*
// @include     http://nanj.matome-ch.com/*
// @include     http://afo-news.com/*
// @include     http://nanjallstars.net/*
// @include     http://nanj.an-matome.com/*
// @include     http://antennabank.com/*
// @include     http://newsnow-2ch.com/*
// @include     http://mh12.info/*
// @include     http://killmej.com/*
// @include     http://mt-antenna.info/*
// @include     http://thebaseball.xyz/*
// @include     http://proyakyuantenna.com/*
// @include     http://bouyomi.jp/*
// @include     http://digital-mixnews.com/*
// @include     http://news.cnects.net/*
// @include     http://athena.sakuratan.com/*
// @include     http://digital-soccer.net/*
// @include     http://2chmatome-news.com/*
// @include     http://nanjheadline.com/*
// @include     http://alfalfalfa.com/*
// @include     http://yajiuma-antena.com/*
// @include     http://owt.io/*
// @include     http://kyuusai2nd.net/*
// @include     http://kanasoku.info/*
// @include     http://rd.app-heaven.net/*
// @include     http://applinews24.com/*
// @include     http://*.antenna-3.com/*
// @include     http://2ch-mma.com/*
// @include     http://matomenomori.net/*
// @include     http://newsquo.net/*
// @include     http://egone.org/*
// @include     http://hapiyaku.com/*
// @include     http://yuukoku.net/*
// @include     http://isekaitraffic.livedoor.biz/*
// @include     http://www.lifeappli-antenna.com/*
// @include     http://iwashi.biz/*
// @include     http://www.news1000000.com/*
// @include     http://ga-t.net/*
// @include     http://www.hiroburo.com/*
// @include     http://newtroc.net/*
// @include     http://watashe.blog135.fc2.com/*
// @include     http://hemine.co/*
// @include     http://esite100.com/*
// @include     http://imakita.cowhow.net/*
// @include     http://plasma-antenna.com/*
// @include     http://www.newposu.com/*
// @include     http://kijyo-antena.com/*
// @include     http://kdkjch.com/*
// @include     http://dietantenna.net/*
// @include     http://nanteko.com/*
// @include     http://sepian.org/*
// @include     http://antenasu.net/*
// @include     http://rss-seo.click/*
// @include     http://kaigai-antena.com/*
// @include     http://2chmm.com/*
// @include     http://handero.net/*
// @include     http://blue-a.org/*
// @include     http://marugoto-antenna.com/*
// @include     http://poka-n.net/*
// @include     http://vipick.net/*
// @include     http://news-channel.doorblog.jp/*
// @include     http://trtd.info/*
// @include     http://antennapan.info/*
// @include     http://*.ozmaker.net/*
// @include     http://b-news.doorblog.jp/*
// @include     http://honey-tiger.ldblog.jp/*
// @include     http://matome-crawler.com/*
// @include     http://shimasoku.com/*
// @include     http://news-matome.com/*
// @include     http*://pun6.com/*
// @include     http://antenow.com/*
// @include     http://bokuantena.com/*
// @include     http://mitena.net/*
// @include     http://ii-net-ii.com/*
// @include     http://*.kaeru.me/*
// @include     http://*.nantoka-antenna.com/*
// @include     http://arumira.com/*
// @include     http://gayaruantenna.com/*
// @include     http://nanjmin.net/*
// @include     http://kanone.biz/*
// @include     http://*.fantena.net/*
// @include     http://past2chmatome.blog55.fc2.com/*
// @include     http://pllp.info/*
// @include     http://newtopics.info/*
// @include     http://rankin9.com/*
// @include     http://news109.com/*
// @include     http://red-an.com/*
// @include     http://gossipantenna.com/*
// @include     http://hapikichi.com/*
// @include     http://indexmatome.com/*
// @include     http://newslogfc2.blog.fc2.com/*
// @include     http://pikupikku.ldblog.jp/*
// @include     http://matomeofmatomes.net/*
// @include     http://funger-antena.info/*
// ==/UserScript==

var siteDefs = {
  // しぃアンテナ(*゚ー゚)
  '2ch-c.net': ['a.et_title',
                textContent(null, 'table.entry a[target="_blank"]')],

  // 2GET
  'get2ch.net': ['li.pickup a',
                 'a.list-group-item[style="color:#F55;font-weight:bold;"]'],

  // The 3rd
  'the-3rd.net': ['a.ui-link[style^="color:#F33"]',
                  descendantClass('div#l_col a', 'span[style^="color:"]')],

  // ワロタあんてな
  'matomeantena.com': [replaceFeedClick('.current a.feed-click'),
                       replaceFeedClick('.active-feed a.feed-click'),
                       '.rss_link > a'],

  // にゅーれす
  'newresu1.blog.fc2.com': ['.title_link a', 'li.pickup a', '#pickupnews .title_link_a'],
  // にゅーもふ
  'newmofu.doorblog.jp': ref('newresu1.blog.fc2.com'),
  // にゅーおた
  'newota.blog.fc2.com': ref('newresu1.blog.fc2.com'),
  // にゅーやく
  'newyaku.blog.fc2.com': ref('newresu1.blog.fc2.com'),
  // にゅーえろ
  'newero1.blog.fc2.com': ref('newresu1.blog.fc2.com'),

  // だめぽアンテナ
  'moudamepo.com': ['li.ui-btn-up-e a.ui-link-inherit',
                    descendantClass('a.ui-link-inherit', 'span[style="color:#ff0000;"]'),
                    '.headline_pkup a', '.hl_pkup a'],

  // ぶろにゅー
  // UAをPCにする
  'blog-news.doorblog.jp': function() {
    var t = queryString('t');
    if (t) {
      t = decodeURIComponent(t);
      if (byDescendantTextContent(function(){return t;}, 'li a', 'span.a-title', targetStartsWithTitle))
        return;
    }
    byClass('a.title_link');
  },

  // ぬるぽあんてな
  'nullpoantenna.com': [replaceFeedClick('li.current a.feed-click'),
                        replaceFeedClick('li.active-feed a.feed-click')],

  // にゅーぷる
  // リンク先が間違っているときは飛ばない
  'newpuru.doorblog.jp': function(){
    var url = queryString('url');
    if (url)
      url = reverse(decodeURIComponent(url));
    else {
      var match = window.location.href.match(/#url=(.+)/);
      if (!match)
        return;
      url = match[1];
    }
    openLink(url);
  },

  // best trend news
  'besttrendnews.net': ['div.entry[data-type="catchy"] a',
                        'div.select a'],

  // LogPo!2ch
  // mobile版は対応不可
  //'2ch.logpo.jp': '.caption a',
  // 2015-02-19: リニューアルしたらしいが
  '2ch.logpo.jp': 'div.PickArticle a',
  's.2ch.logpo.jp': 'h2.ArticleLink a',

  // アナグロあんてな
  'anaguro.yanen.org': ['td.title a.title', 'div[style="padding:4px 2px;background-color:#ffffff;"] a[target="_blank"]'],

  // アンテナ速報
  'a.anipo.jp': '#tbody tr[style^="background-color: rgb(255, 176, 187)"] a[title]',

  // 勝つるあんてな
  'katuru.com': '.rss_center_div a',

  //newschoice
  'news-choice.net': function() {
    var l = queryString('l');
    if (l && byClass('a[href="' + decodeURIComponent(l) + '"]'))
      return;
    byClasses('#article [data-type="catchy"] a',
              '.pickuptitle a');
  },

  // 2次元と3次元の画像ブログまとめ
  'img.favsite.jp': descendantClass('div a.stp', 'h2'),

  // わくてか
  'wk-tk.net': 'div.selected a',

  // News人
  'newser.cc': 'tr.target a',

  // キタコレ
  // 'a.link-red' or 'a.link-pink'?
  'kita-kore.com': ['.article.active a',
                    textContent(null, 'div.list[style^="display: block"] a', titleStartsWithTarget)],

  // ねらーアンテナ
  '2channeler.com': function() {
    var qs = getParameters();
    var n = qs.n, d = qs.d;
    if (n && d && byClass("a.title[onmouseover^=\"thumb_on('" + n + "','" + d + "'\"]"))
      return;

    if (n && byClass('a.title[href^="http://2channeler.com/out.cgi?n=' + n + '&"]'))
      return;

    var targets = queryNodes('div#thumb_box > div');
    for (var i = 0, len = targets.length; i < len; i++)
      if (targets[i].querySelector('div label').textContent.trim() == 'Pickup') {
        var target = targets[i].querySelector('a.ui-link');
        if (target && openLink(target.getAttribute('href')))
          return;
      }

    byClasses('tr.line4 a', 'tr.line3 a');
  },

  // matomeja
  'matomeja.jp': 'div.active .entry-title a',

  // しまむらアンテナ
  'shimamurakun.net': 'div#main-item a',

  // 家庭ちゃんねる
  'kateich.net': 'li.linktitle a',

  // つーアンテナ
  '2ch-2.net': function() {
    // ページを移動するときにうざいポップアップを出さない
    var e = queryNode('.active .entry-title');
    if (e)
      e.className = '';
    byClass('.active a');
  },

  // のーアンテナ
  '2ch-n.net': ['.main-column .feed-list .entry-item.active .entry-title a',
                '.active .feed_title a'],

  // なんか憑かれた速報
  'nantuka.blog119.fc2.com': textContent('h3 > a', 'div.article a'),

  // ライフあんてな
  // UAをPCにする
  'lifeantenna.com': ['.entry-item.active .entry-title a',
                      'tr.active .feed_title a'],

  // ギコにゅー
  'giko-news.com': ['.article.active a', '#article-contents a.link-red', '#article-list-body li.selected a'],

  // するめアンテナ
  'matome-surume.com': 'tr.active .feed_title a',

  // 放課後ガイドライン
  'blog.livedoor.jp/houkagoguide': [textContent('h2.entry-title > a', 'div.article-body-more a'),
                                    textContent(null, 'div#article-contents a', titleStartsWithTarget)],

  // キットカスタネット
  'blog.livedoor.jp/ind_bikkuri': descendantClass('div.article-body a', 'span[style^="color:"]'),

  // わろたあっろと
  'blog.livedoor.jp/warota_a_lot': 'article#Article > h2 > div > div:not([class]) > a',

  // ニュースJAPAN
  'blog.livedoor.jp/hioaysdnhjlk': '.title_link a',

  // NEWS DIJEST
  'blog.livedoor.jp/gndai': textContent(null, '.article-body a', titleStartsWithTarget),

  // 鬼女の集い
  'blog.livedoor.jp/kijyonotsudoi': descendantClass('div.article-body a', 'span[style^="color: rgb(255, 0, 0)"]'),

  // まじかるニュース
  'blog.livedoor.jp/magicalnews': textContent('.article-title', 'div.article-body p a', titleStartsWithTarget),

  // 特設ニュースちゃんねる
  'blog.livedoor.jp/tokusetsu_news': '#title_site a',

  // XEX NEWS
  'blog.livedoor.jp/xexnews': textContent('.article-title', 'div.article-body p a', titleStartsWithTarget),
  
  // watch@2チャンネル
  'watch2ch.2chblog.jp': descendantClass('div.article-body a', 'span.pickup_link'),

  // 2chファインダー
  '2chfinder.com': ['li.single a', 'ul.single a'],

  // ぐるぐるログ
  // UAをPCにする
  'gurugurulog.com': function() {
    var n = queryString('n');
    if (n)
      byClass('.article .cat-kiji-title.kiji_n-' + n + ' a');
    else
      byClass('.article .title_link a');
  },

  // j-antenna
  'www.j-antenna.com': ['.pickup_entry_title a', 'a.pickup_entry_title'],

  // とろたまヘッドライン
  'headline.mtfj.net': 'td.bold a',

  // アンテナちゃん
  'antennachan.com': 'div#rline_pu div.netalink a',

  // 朝目新聞
  'www.ne.jp/asahi': 'a.feedtitle',

  // 2chまとめヘッドライン
  '2ch-matome.com': [descendantClass('a.main_content_link', 'p.pickup_article'),
                     descendantClass('a.mainContentLink', 'span.red')],

  // 特価板
  'tokkaban.com': 'li.current a',

  // オワタあんてな
  'owata.chann.net': ['.pickup a.article-link',
                      'div.active .choice a'],

  // NEWS PICK UP
  'newspickup.com': 'p.active a',

  // まとめアンテナ(´∀`)
  '2ch-m.net': textContent(null, 'tr.entry a', titleStartsWithTarget),

  // BaseBall MAG
  'baseball-mag.net': descendantClass('article#content a', 'div.title[style^="color:"]'),

  // ニュー速
  'new-soku.net': 'a.target_article',

  // 2chアンテナ
  'www.2ch-antenna.net': 'a._txt_red',

  // ギコあんてな!
  'gikotena.net': ['.pickup .site_content_title a',
                   'a.label_list_content_title'],

  // まとねっと
  'matonet.info': 'a.pickup',

  // みんくるアンテナ( ゚Д゚)
  'minkurumato.net': 'td.feed_title a[style="color:red"]',

  // ニュース星3つ!
  'news-three-stars.net': ['div[data-type="catchy"] a.entry-title', 'div[data-type="catchy"] .entry-title a', 'div.select a'],

  // まとめたった速報www
  'matometatta-news.net': ['div[data-type="catchy"] a.entry-title', 'div[data-type="catchy"] .entry-title a', 'div.pickuplink.title a'],

  // NEWS SELECT
  'news-select.net': ['.article.active a',
                      'li.selected a'],

  // harikonotora
  'rss.harikonotora.net': textContent(null, 'div.headline a.kizi'),

  // にゅーすなう!
  'vipsister.blog72.fc2.com': 'div.selected a',
  // にゅーすなう!
  'newsnow-2ch.com': '#article [data-type="catchy"] a.entry-title',

  // P!アンテナ
  'www.pantena.net': 'article#main-entry a',

  // ニュース速報まとめ梅
  'matomeume.com': ['div.kijis5 a', 'div.kjran3 a'],

  // ニュース速報まとめ桜
  'matomesakura.com': ['div.kijis5 a', 'div.kjran3 a'],

  // 2chまとめちゃんねる
  'matome-ch.com': textContent(null, 'div.entrys_title a', titleStartsWithTarget),

  // おまとめ
  '0matome.com': 'div.pickup a',

  // 2chまとめ
  'www.2chantena.info': textContent(null, 'div.entry-title a', titleStartsWithTarget),

  // Rotco
  'rotco.jp': 'td.articleTitle a[style^="color:"]',

  // ウホウホあんてな
  'uhouho2ch.com': 'li.pickup a',

  // アフォニュース
  'afoafodayo.blog84.fc2.com': 'div.selecttitle a',

  // アフォニュース
  'afo-news.com': ['#article [data-type="catchy"] .entry-title a',
                   '#article [data-type="catchy"] a.entry-title'],

  // マトメナ
  'matomena.jp': 'div.linked_article a',

  // 日刊鬼女通信
  'nkijo.com': 'a.Bp2ATitleKiji',

  // 2ちゃんてな
  '2ch-antenna.com': 'td.article_title a[style^="color"]',

  // つくるよあんてな
  'www.tukuruyoantena.com': 'table.entrylist a[style^="color"]',

  // まとめニュース速報
  'www.まとめニュース.com': 'div.article_box a[style^="color"]',
  'www.xn--o9j0bk8t7cqhlg.com':  'div.article_box a[style^="color"]',

  // 2ちゃんねるまとめるまとめ
  '2chmatomeru.info': 'tr[style^="background-color"] td.tdLink a',

  // ワニアンテナ
  'waniantenna.com': 'a.story-title-link.red',

  // GOSSIP CHANNEL
  'gossip2.net': ['.mainArea .main .topArticle .txtCell h2 a',
                  'div.art-title-sp > div > a',
                  'div.art-rank > div > a:first-child',
                  'div.art-rank > div > a:nth-child(2)',
                  function() {
                    var id = queryString('id');
                    if (id && id.length > 3)
                      byClass('div.art-anchor[data-article-num="' + id.substring(3) + '"] a');
                  }],

  // 乞食速報
  'kojikisokuhou.com': 'div.body > ul.entries > li.entry > span > a',

  // マルチメディアNEWS
  'multi-media.doorblog.jp': [textContent('h1.article-title', 'div#article-contents a[target="_blank"]'),
                              'div.article-body-inner > a:last-child'],

  // エ・ロックオン
  'blogtsurugi.blog38.fc2.com': 'div.postmain a[title]',

  // この●●クソワロタwww
  'konowaro.net': function() {
    var l = queryString('l');
    if (l && byClass('a[href="' + decodeURIComponent(l) + '"]'))
      return;
    if (!byClass('#article [data-type="catchy"] a') &&
        !byTextContent('div.title h2 a', 'div.selected a', targetStartsWithTitle))
      byClass('div.selected a');
  },

  // ギコあんてな
  'giko2ch.net': 'a.post_link.pickup',

  // MEGA NEWS LAUNCHER
  'dariusnews.blog11.fc2.com': textContent(null, 'li a', titleStartsWithTarget),

  // 2chまとめ放送局
  '2ch-a.info': 'tr.danger a',

  // まとめちゃんねる
  'www.matomech.com': textContent(null, 'td.articleListTableTitle a', titleStartsWithTarget),

  // 【速報】アンテナ(*・ω・)ノ゙
  'www.so9.jp': 'article#rsskizi a',

  // まとにゅー!
  'matonew.doorblog.jp': 'div.p_link a',

  // 奥様アンテナ
  'cawaii2ch.com': textContent(null, 'div.entry a', titleEndsWithTarget),

  // 暇つぶしアンテナ
  'killing-time.biz': 'a.titlematch',

  // 2chまとめSPOT
  '2ch-spot.com': function() {
    var f_id = queryString('f_id');
    if (!f_id || !byClass('a.future-entry[data-entry-id="' + f_id + '"]'))
      byClass('a.future-entry[style*="display: block"]');
  },

  // おにちゃんねる
  'o-2ch.net': 'td.article.red a',

  // 情報屋さん。
  'jyouhouya3.net': 'a.link_ra',

  // せちがら速報
  'www.sechigara.net': [checkExists('div.t_h'),
                        'div.article-body-inner > a',
                        descendantClass('div.article-body > a', 'b > span[style^="color: rgb(255, 0, 0)"]')],

  // 超速V話題のまとめちゃん
  'cyousokuvip.com': [checkExists('div.t_h'),
                      descendantClass('div.article-body-inner > a', 'span[style^="color: rgb(255, 0, 0)"]'),
                      descendantClass('div.article-body > a', 'span[style^="color: rgb(255, 0, 0)"]')],

  // ウチのトメさまがいちばんカワイイ
  'uchitome.com': [checkExists('div.t_h'),
                   descendantClass('div.article div.main > a', 'span[style^="color: rgb(255, 0, 0)"]'),
                   descendantClass('div.article-body > a', 'span[style^="color: rgb(255, 0, 0)"]')],

  // ワロタめーかー
  '.warotamaker.com': replaceFeedClick('li.active-feed a.feed-click'),
  // ワロタめーかーH
  '.warotah.com': ref('.warotamaker.com'),

  // 声優アンテナ~二次元まとめ~(feed)
  'seiyuu-antena.antena-nijimatome.com/feed': ['td.feed_title a[style="color:red"]', 'div.feed_title a[style="color:red"]'],

  // 声優アンテナ~二次元まとめ~(article)
  'seiyuu-antena.antena-nijimatome.com/abs': ['div#articles > div.source > a[target="_blank"]', 'div#articles > a[target="_blank"]'],

  // 二次元アンテナ速報
  'seiyuu.seiyuu-antenna.info/feed': ref('seiyuu-antena.antena-nijimatome.com/feed'),
  'seiyuu.seiyuu-antenna.info/abs': ref('seiyuu-antena.antena-nijimatome.com/abs'),

  // 声優アンテナ~まとめ~
  'seiyuu.antena-matome-2ch.com': 'a.rclick[style="color:red"]',

  // アンテナメーカー
  '.antenam.info': function() {
    if (byClass('span.target_item a'))
      return;
    var path = window.location.pathname;
    var match;
    if ((match = path.match(/\/items\/view\/(\d+)/)))
      byClass('a[href^="/items/click/' + match[1] + '"]');
    else if ((match = path.match(/\/items\/search\/title:(.+)/)))
      byTextContent(function(){return decodeURIComponent(match[1]);}, '.item_title_list a.blog_post');
  },
  '.antenam.biz': ref('.antenam.info'),
  '.antenam.jp': ref('.antenam.info'),
  '.atna.jp': ref('.antenam.info'),
  '.a-antenam.info': ref('.antenam.info'),

  // 【声女】2ch声優速報まとめアンテナ
  'voice.lady.jp': 'div.post > a + a',

  // 声豚あんてな
  'koebuta.net': 'div.pickup a',

  // Girls Reader
  'girlsreader.com': 'h2#single_h2 > a',

  // クマーあんてな
  'kuma-log.net': 'td.article a.rss',

  // キチママまとめアンテナ
  'a-matome.com': function() {
    // urlencodeされている場合は未確認
    var match = window.location.search.match(/\?RSS=\d\d\d\d-\d\d-\d\d([^&]+)/);
    if (match)
      byClass('a[href^="./re.php?URL=' + match[1] + '&"]');
  },

  // アンテナギフト(・∀・)
  'antenna.gift': 'tr.targetItem a[id]',

  // matomatome
  'matomatome.com': ['ul#current a.topictitle', 'div.title a.ui-link'],

  // アンテナシェア
  // ターゲットが複数ある場合は飛ばないようにした
  'www.antennash.com': [textContent(null, 'div.cmain a', targetStartsWithTitle),
                        descendantClass('a', 'span[style*="#1596C1;"]', true)],

  // あんてなガッ!!
  'antenna-ga.com': descendantClass('ul#new-repo-list a', 'strong'),

  // ほのぼのライフあんてな
  'lifech.2-d.jp': 'li.mainitem a',

  // 家庭生活まとめのまとめ
  'katei-matome.com': 'li.item a.featureEntry',

  // 結婚生活 - NewsPod
  'news-pod.net': descendantClass('div#commentlist a', 'span.name[style="color:#E33"]'),

  // 2chnavi
  '2chnavi.net': [textContent('div.content_header_title', 'a.entry_title', titleStartsWithTarget),
                  descendantTextContent('div.content_header .title_text', 'a.entrylistrow_body', 'div.entrylistrow_title', titleStartsWithTarget)],

  // チラアンテナ(つд・ )
  '2ch.anything-navi.net': descendantClass('a[target="_blank"]', 'font[color="RED"]'),

  // つべこアンテナ
  'twobeko.com': 'li.rss_light a',

  // ガールズアンテナ
  'girls-antena.2chblog.jp': 'a.Bp2ATitleKiji',

  // readers.jp
  '.readers.jp': ['.target_item a', descendantTextContent(null, 'a.ui-link-inherit', 'h3', titleStartsWithTarget)],

  // ウェブニュー
  'webnew.net': ['#article [data-type="catchy"] .tablecell-title a',
                 '#article [data-type="catchy"] .entry-title a',
                 '#article [data-type="catchy"] a.entry-title',
                 'p.link_item.active a'],

  // アンテナバンク
  'antennabank.com': '#article [data-type="catchy"] a.entry-title',

  // 芸能ニュース2ch報道
  'geinou2news.blog.fc2.com': [checkExists('div.entry_body div.t_b'),
                               checkExists('div.ently_body div.t_b'),
                               'div.entry_body a[target="_blank"]',
                               'div.ently_body a[target="_blank"]'],

  // まとめあ
  'matomea.net': descendantClass('a.rss_link', 'span.pickup'),

  // ニュー速アンテナ
  'newsoku.jp': descendantClass('ul#pickup-list a', 'span.red'),

  // なんJまとめアンテナ
  '.nantena.pw': '.mp-recommend-entry-1 .mp-entry-title a',

  // 鬼嫁日記〜2ch生活まとめ〜 
  'oniyomediary.com': [checkExists('.article-body .t_b'),
                       descendantClass('div.article-body a', 'span[style^="color: rgb(255, 0, 0)"]')],

  // センミリG(仮)
  '1000mg.sblo.jp': textContent('h3 .title', 'div.text a'),

  // にゅーすAtoZ
  'netaatoz.blog21.fc2.com': 'div.selected a',

  // VIPあんてな
  '2ch-matome.net': ['div.entries a.title[style^="color:red"]',
                     '.entry_title a[style^="color:red"]'],

  // 恋速~恋愛速報2chまとめ~
  'koisoku.net': 'p.Itemtitle a',

  // ぶろまと
  'buromato.com': '#mainentry .entry_title a',

  // にゃんてな!
  'nyan.eggtree.net': function(){
    var id = queryString('a');
    if (id)
      byClass('li.article[id="' + id + '"] a');
  },

  // いーあんてな(#゚w゚)
  'ii-antenna.net': descendantClass('a.e', 'div.t[style="color:#F22;"]'),

  // まとめアンテナα
  'matome-alpha.com': ['.pickup_entry a',
                       '.entry_title_eid a[style^="color: rgb(255, 0, 0)"]'],

  // フットボール速報まとめ
  'fxmtm.net': 'a.topic',

  // メリーニュース
  'merry-news.com': 'tr.active .feed_title a',

  // クリップちゃんねる
  'clipch.com': 'div.article-body div.source a',

  // おもしろニュース
  'aube0.com': 'div.Single div.Singlebody p.Itemtitle a',

  // XNews
  'xnews.jp': function() {
    var target = queryNode('h1#main-topic + div#main-content-search');
    if (target) {
      target = target.querySelector('h1#main-content-search-title a');
      if (target)
        openLink(target.getAttribute('href'));
    }
  },

  // NANJ of US
  'nanj-of-us.main.jp': '.r_entry a',

  // なんJまとめアンテナ
  'nanj-matome.com': ['a.flink',
                      textContent(null, 'h3 a', titleEndsWithTarget)],

  // YomYo
  'yomyo.jp': function() {
    if (!byClass('a.btn-app-dl', 'data-link'))
      byClass('.blog--list.layout--highlight a');
  },

  // ちゃんねる365
  '365dys.com': ['div.bar.link + table.article .title a',
                 'div.bar.link + table.article .entry a'],

  // STANAVI
  'sta-navi.net': [descendantClass('.rss_pc_td a', 'div.rss_pc_body[style="color:deeppink;"]'),
                   descendantClass('.rss_sp_td a', 'div.rss_sp_body[style="color:deeppink;"]')],

  // もやしアンテナ
  'moyashi.me': descendantClass('table.table a', 'font[color="#fc3939"]'),

  // 2ちゃんマップ
  // とりあえず最初のやつ
  'sp.2chmap.com': 'ul#List a',
  '2chmap.com': 'table.list a',

  // 忍者あんてな(β)
  'antenna.shinobi.jp': ['h2.showcase-title a',
                         descendantClass('.c-showcase a', '.showcase-title')],

  // TREND NEWS24
  'trend-pr.com': 'div.article > a',

  // V速NEWS
  'vipper774.blog115.fc2.com': 'li.selected a',

  // 2chまとまと
  '2ch-matomato.com': ['.layout--highlight a', '.blog--highlight a'],

  // なんJまとめちゃんねる
  'nanj.matome-ch.com': textContent(null, 'div.entry_title a', titleStartsWithTarget),

  // なんJオールスターズ
  'nanjallstars.net': [textContent(null, 'div.entry_title a', titleEndsWithTarget),
                       textContent(null, 'div.entry_title a', titleStartsWithTarget)],

  // プロやきう・なんJまとめアンテナ
  'nanj.an-matome.com': function() {
    var rss = queryString('RSS');
    if (rss && rss.length > 10) {
      var url = decodeURIComponent(rss.substring(10));
      if (byClass('a[href^="./re.php?URL=' + url + '"]') ||
          byClass('a[href="' + url + '"]'))
        return;
    }
  },

  // もくぬふいんふぉ
  'mh12.info': '#main .linkblockspe .rsslink a',

  // キルjアンテナ
  'killmej.com': '#pickup_area a',

  // MeeTreeアンテナ
  'mt-antenna.info': 'div.article_inner.pick a',

  // THE BASEBALL
  'thebaseball.xyz': '#tabs-1 ul li:first-child a',

  // プロ野球アンテナ
  'proyakyuantenna.com': function() {
    var targets = queryNodes('.article-wrap');
    for (var i = 0, len = targets.length; i < len; i++) {
      if (targets[i].querySelector('.article-access')) {
        var match = targets[i].onclick.toString().match(/window\.open\('(.*)'\)/);
        if (match)
          return openLink(match[1]);
        return false;
      }
    }
  },

  // 棒読みあんてな
  'bouyomi.jp': 'a[style="color:red"]',

  // デジタルニュースミックス
  'digital-mixnews.com': textContent('.article-title', '.pickup-news a',
                                     function(target, title) {
                                       return titleEndsWithTarget(target.replace(' ', ' '), title.replace(' ', ' '));
                                     }),

  // コネクツニュース
  'news.cnects.net': '#news-main .btn a',

  // アテナあんてな
  'athena.sakuratan.com': '#hot_article .top a',

  // DIGITAL-SOCCER.NET
  'digital-soccer.net': 'a.news_title[style^="color:red"]',

  // !ANTENNA?
  '2chmatome-news.com': 'a#pickup',

  // なんJ Headline
  'nanjheadline.com': '#detail_title a',

  // アルファルファモザイク
  'alfalfalfa.com': descendantTextContent(null, 'a', 'span.sidebody', titleStartsWithTarget),

  // やじうまあんてな
  'yajiuma-antena.com': '.red a',

  // オワタあんてな
  'owt.io': '.post-content a',

  // ○○的ニュースをお伝え(以下略
  //  (究極最終兵器2ndWeapon)
  'kyuusai2nd.net': textContent(null, 'a[target="_blank"]', titleStartsWithTarget),

  // カナ速
  //'kanasoku.info': function() {
  //  if (!queryNode('div.body span.nnn'))
  //    byClass('div.body div.tt a');
  //},

  // まとめアンテナChaconne.
  'rd.app-heaven.net': [descendantClass('#app_info a', '.btn-primary'),
                        'a.browserlink'],

  // アプリNews24
  'applinews24.com': ['.reco.addin > a',
                      '.item_title_pickup > a'],

  // 2chまとめアンテナ
  '.antenna-3.com': 'a[style="font-weight:700;color:#E27689"]',

  // 2chまとめのまとめアンテナ
  '2ch-mma.com': '#article [data-type="catchy"] a.entry-title',

  // まとめの杜(壱)
  'matomenomori.net': 'a#top_caption_a',

  // ニュー速クオリティ@アンテナ
  'newsquo.net': '.entry_title a[style="color:#ff0000;"]',

  // everything is gone
  'egone.org': textContent(null, 'div.nn a', titleStartsWithTarget),

  // はぴやく
  'hapiyaku.com': '.danger a',

  // 憂国あんてな
  'yuukoku.net': [descendantClass('a.ui-link-inherit', 'span.rl1'),
                  '.pickup a.hl_title1'],

  // 異世界とらふぃっく!
  'isekaitraffic.livedoor.biz' : 'a.Bp2ATitleKiji',

  // ライフアプリアンテナ
  'www.lifeappli-antenna.com': [descendantClass('.articles-lists a', '.lists-text p.current'),
                                '.articles-contents .article-contents-title a'],

  // いわしアンテナ >°))))彡
  'iwashi.biz': descendantClass('.article a', 'font[style^="background-color:#FFCCCC"]'),

  // ニュース$ミリオネア
  'www.news1000000.com': '#archive_list a.archive_links.title_archive',

  // ガッてな
  'ga-t.net': ['.sparticle.red a', '.article.red a'],

  // ひろぶろ
  'www.hiroburo.com': '.article-body span[style="color: rgb(255, 0, 0);"]+a',

  // にゅ~とろアンテナ
  'newtroc.net': '#main-contents .antena-content .linkcontent a',

  // 私女だけどw
  'watashe.blog135.fc2.com': textContent(null, 'div.body a', titleStartsWithTarget),

  // ヘミ猫あんてな
  'hemine.co': '.selected .entry-title a',

  // 良いサイト100選
  'esite100.com': ['#mainentry a',
                   descendantClass('.entry_title_pic a', 'b[style="color:#ff0000;"]')],

  // 今北広報
  'imakita.cowhow.net': descendantClass('.entryTitle a', 'em'),

  // プラズマアンテナ
  'plasma-antenna.com': '#articles .feed_title a[style="color:red"]',

  // にゅーぽす
  'www.newposu.com': '.pickup-list .specify a',

  // KIJYO ANTENA 
  'kijyo-antena.com': descendantClass('.title a', 'font[color="#ff0000"]'),

  // 気団・鬼女ちゃんねる
  'kdkjch.com': descendantClass('.entry_title_all a', 'p.pagetitle'),

  // ダイエットあんてな
  'dietantenna.net': ref('kdkjch.com'),

  // /(^o^)\ナンテコッタイ
  'nanteko.com': 'a.pickup_title',

  // セピアンテナ
  'sepian.org': '.single_box article a',

  // アンテナっす
  'antenasu.net': 'a[style="font-weight:700;color:#E27689"]',

  // RS2 ANTENNA
  'rss-seo.click': descendantClass('.single-post-detail > a', '.single-post-blanklink'),

  // 海外アンテナ
  'kaigai-antena.com': '.pick_line a',

  // 2chまとめのまとめ
  // よくわからないので転送ページだけを対象にする。
  '2chmm.com/c': '.wrapper a.post',

  // はんでろan
  'handero.net': '.news-link.target a',

  // ブルーアンテナ
  'blue-a.org': descendantClass('.arrow_red a', 'span[style="color:#ff0000;"]'),

  // まるごとアンテナ
  'marugoto-antenna.com': [textContent(null, '.pickup a', titleStartsWithTarget),
                           descendantClass('nav a', 'font[color="red"]')],

  // ポカーンあんてな
  'poka-n.net': 'a.cc[style="font-size:24px;color:red;font-weight:bold;"]',

  // vipick.net
  'vipick.net': '.active .title a',

  // NEWS CHANNEL
  'news-channel.doorblog.jp': descendantClass('.articles li a', 'font[color="RED"]'),

  // とらとどあんてな
  'trtd.info': 'article .mainclass a',

  // あんてなパン
  'antennapan.info': '#article-title a.content-link',

  // オズメーカー
  '.ozmaker.net': ['.danger a', descendantClass('a.list-group-item', '.text-active')],

  // びニュー!
  'b-news.doorblog.jp': 'a.archive_links.title_red',

  // ハニトラフニトラ
  'honey-tiger.ldblog.jp': ['.cat-kiji-title a',
                            function() {
                              var qs = getParameters();
                              var c = qs.c, n = qs.n;
                              if (c && n)
                                byClass('.' + c + '.kiji_n-' + n + ' a');
                            }],

  // まとめクロラ
  'matome-crawler.com': descendantClass('li.entry', 'span[style^="color:#F33;"]'),

  // しま速
  'shimasoku.com': descendantClass('.contents a', 'span[style="color:red;"]'),

  // まとめてニュース
  'news-matome.com': '.notice_kiji_kobetu .kiji_title a',

  // ツイキチ
  'pun6.com': '#mainKiji a.kijiClickMain',

  // アンテなう!
  'antenow.com': 'h4.feedtb2 a',

  // ぼくあんてな
  'bokuantena.com': 'a#pickup',

  // みてなアンテナ
  'mitena.net': ['.entry-titlet a',
                 '.content.single .post .sequel a'],

  // イイネット(・∀・)イイ!!
  'ii-net-ii.com': 'a.pickupentry',

  // カエル.me
  '.kaeru.me': ['.title a[data-pickup]',
                'li a[data-pickup]'],

  // ナントカアンテナ
  '.nantoka-antenna.com': descendantClass('a.entry_anchor', '.entry_title[style$="rgb(255, 204, 204);"]'),

  // ギコにゅー(,,゚Д゚) 
  'blog.livedoor.jp/navippu': '.selected a',

  // あるみら!
  'arumira.com': textContent(function(){return documentTitle().replace(/^あるみら! - /, '');},
                             '.rss_category a', targetEndsWithTitle),

  // ガヤるアンテナ( ・∀・)ノ
  'gayaruantenna.com': '#mainentry a',

  // J民あんてな
  'nanjmin.net': ['.pickup a.hl_title1',
                  descendantClass('a.ui-link-inherit', 'span[style="color:red;"]')],

  // キャノンアンテナ
  'kanone.biz': ['.feed_pickup a.title_link',
                 '.feed_pickup a.rss_link'],

  // ファンテナ
  '.fantena.net': function() {
    var match = window.location.pathname.match(/^\/(\d+)$/);
    if (match)
      byClass('a.rssid' + match[1]);
  },

  // 近頃のまとめブログ
  'past2chmatome.blog55.fc2.com': textContent(null, '.e-text a', titleStartsWithTarget),

  // クレイジーアンテナ
  'pllp.info': [descendantClass('#headline_block a', 'font[color="red"]'),
                descendantClass('a.ui-link-inherit', 'font[color="red"]')],

  // まとめのあんてな
  'newtopics.info': textContent(function(){return documentTitle().replace(/ \| まとめのあんてな$/, '');},
                                '.content_item_link a.link_a', titleEndsWithTarget),

  // まとめにゅーアンテナ
  'rankin9.com': function() {
    var target = querySelector(nextElementSibling(parentNode(queryNode('.list_title_entry a.check'))), '.tuduki a');
    return target && openLink(target.getAttribute('href'));
  },

  // にゅーす特報。
  'news109.com': textContent(function(){return documentTitle().replace(' ', '');},
                             '.article-body a', titleStartsWithTarget),

  // レッドアンテナ
  'red-an.com': function() {
    var u = queryString('u');
    if (u)
      openLink(reverse(decodeURIComponent(u)));
  },

  // GossipAntenna
  'gossipantenna.com': textContent(null, 'a.content_title', titleStartsWithTarget),

  // はぴきち
  'hapikichi.com': '.danger a',

  // indexmatome.com
  'indexmatome.com': '#sort > ul > li > a[itemprop="url"]',

  // NewsLog
  'newslogfc2.blog.fc2.com': 'li.selected a',

  // ぴっくんあんてな
  'pikupikku.ldblog.jp': descendantClass('.title a', 'font.fbg1'),

  // まとめのまとめニュース
  'matomeofmatomes.net': textContent(null, 'a.newarticle', titleEndsWithTarget),

  // (っ`ω´c) ふんがーアンテナ
  'funger-antena.info': '.top_option .kiji_link a'
};

function toAction(action) {
  if (!action)
    return null;

  var type = typeof action;
  if (type == 'function')
    return action;
  if (type == 'string')
    return function() {byClass(action);};
  if (isArray(action))
    return function() {
      for (var i = 0, len = action.length; i < len; i++) {
        var fn = toAction(action[i]);
        if (fn && fn())
          return true;
      }
      return false;
    };
  return null;
}

function getAction() {
  var host = location.host;
  var action = siteDefs[host];
  var arr, i, len;

  if (!action) {
    arr = location.pathname.split('/');
    for (i = 1, len = arr.length; i < len && !action; i++) {
      host += '/' + arr[i];
      action = siteDefs[host];
    }
  }

  if (!action) {
    host = '';
    arr = location.host.split('.');
    for (i = arr.length - 1; i >= 0 && !action; i--) {
      host = '.' + arr[i] + host;
      action = siteDefs[host];
    }
  }

  return toAction(action);
}

function queryNode(selector) {
  return document.querySelector(selector);
}

function queryNodes(selector) {
  return document.querySelectorAll(selector);
}

function parentNode(e) {
  return e && e.parentNode;
}

function nextElementSibling(e) {
  if (!e)
    return null;
  if (e.nextElementSibling)
    return e.nextElementSibling;
  do
    e = e.nextSibling;
  while (e && e.nodeType !== 1);
  return e;
}

function documentTitle() {
  var title = queryNode('title');
  return title ? title.textContent : '';
}

function querySelector(e, selector) {
  return e && e.querySelector(selector);
}

function checkExists(selector) {
  return function() {return queryNode(selector);};
}

function ref(site) {
  return function() {
    var action = toAction(siteDefs[site]);
    return action && action();
  };
}

// querystringを取得する。
function getParameters() {
  var r = {};
  var p = window.location.search.substring(1).split('&');
  for (var i = 0; i < p.length; i++) {
    var e = p[i].split('=');
    r[e[0]] = e[1];
  }
  return r;
}

function queryString(name) {
  return getParameters()[name];
}

function isArray(obj) {
  return Object.prototype.toString.call(obj) === '[object Array]';
}

function reverse(s) {
  return s.split('').reverse().join('');
}

var targetFound = false;

function openLink(target) {
  if (!targetFound) {
    if (!target || startsWith(target, 'https://play.google.com/'))
      return false;
    targetFound = true;
    window.open(target, '_self').focus();
  }
  return true;
}

// ターゲットを直接特定できるサイト
function byClass(targetQuery, ref) {
  var target = queryNode(targetQuery);
  if (target)
    return openLink(target.getAttribute(ref || 'href'));
  return false;
}

// ターゲットの配列で特定できるサイト
function byClasses() {
  for (var i = 0, len = arguments.length; i < len; i++)
    if (byClass(arguments[i]))
      return true;
  return false;
}

function classes() {
  var args = arguments;
  return function() {return byClasses.apply(null, args);};
}

// ターゲットの子孫から特定できるサイト
function byDescendantClass(targetQuery, descendantQuery, singleOnly) {
  var targets = queryNodes(targetQuery);
  var found = null;
  for (var i = 0, len = targets.length; i < len; i++)
    if (targets[i].querySelector(descendantQuery)) {
      if (singleOnly) {
        if (found)
          return false;
        found = targets[i];
      }
      else if (openLink(targets[i].getAttribute('href')))
        return true;
    }
  return found && openLink(found.getAttribute('href'));
}

function descendantClass(targetQuery, descendantQuery, singleOnly) {
  return function() {return byDescendantClass(targetQuery, descendantQuery, singleOnly);};
}

function startsWith(str, prefix) {
  return str.lastIndexOf(prefix, 0) === 0;
}

function endsWith(str, suffix) {
  return str.indexOf(suffix, str.length - suffix.length) !== -1;
}

// titleがtarget+anyのとき
function titleStartsWithTarget(target, title) {
  return startsWith(title, target);
}

// titleがany+targetのとき
function titleEndsWithTarget(target, title) {
  return endsWith(title, target);
}

// targetがtitle+anyのとき
function targetStartsWithTitle(target, title) {
  return startsWith(target, title);
}

// targetがany+titleのとき
function targetEndsWithTitle(target, title) {
  return endsWith(target, title);
}

function initMatcher(matcher) {
  return matcher ? matcher : function(target, title) {return target == title;};
}

// タイトルを取得する。
// titleQueryがfunction: 関数が返す文字列
// titleQueryがnull: ドキュメントのタイトル
// titleQueryがCSSセレクタ: セレクタに一致するノードの内容
function getTitle(titleQuery) {
  var title;
  if (typeof titleQuery == 'function')
    title = titleQuery();
  else {
    title = queryNode(titleQuery || 'title');
    if (!title)
      return null;
    title = title.textContent;
  }

  if (!title)
    return null;
  title = title.trim();
  if (!title.length)
    return null;
  return title;
}

// ターゲットをタイトル文字列から特定できるサイト
function byTextContent(titleQuery, targetQuery, matcher) {
  matcher = initMatcher(matcher);
  var title = getTitle(titleQuery);
  if (!title)
    return false;

  var targets = queryNodes(targetQuery);
  for (var i = 0, len = targets.length; i < len; i++) {
    var text = targets[i].getAttribute('title');
    if (text && matcher(text.trim(), title) && openLink(targets[i].getAttribute('href')))
      return true;
    text = targets[i].textContent;
    if (text && matcher(text.trim(), title) && openLink(targets[i].getAttribute('href')))
      return true;
  }
  return false;
}

function textContent(titleQuery, targetQuery, matcher) {
  return function() {return byTextContent(titleQuery, targetQuery, matcher);};
}

// ターゲットの子孫のテキストとタイトル文字列から特定できるサイト
function byDescendantTextContent(titleQuery, targetQuery, descendantQuery, matcher) {
  matcher = initMatcher(matcher);
  var title = getTitle(titleQuery);
  if (!title)
    return false;

  var targets = queryNodes(targetQuery);
  for (var i = 0, len = targets.length; i < len; i++) {
    var descendant = targets[i].querySelector(descendantQuery);
    if (descendant) {
      var text = descendant.textContent;
      if (text && matcher(text.trim(), title) && openLink(targets[i].getAttribute('href')))
        return true;
    }
  }
  return false;
}

function descendantTextContent(titleQuery, targetQuery, descendantQuery, matcher) {
  return function() {return byDescendantTextContent(titleQuery, targetQuery, descendantQuery, matcher);};
}

// リンクをリプレースするサイト
function byReplaceHref(targetQuery, oldValue, newValue) {
  var target = queryNode(targetQuery);
  if (target)
    return openLink(target.getAttribute('href').replace(oldValue, newValue));
  return false;
}

// リンクの'/feed/'を'/feed-click/'にリプレースするサイト
function byReplaceFeedClick(targetQuery) {
  return byReplaceHref(targetQuery, '/feed/', '/feed-click/');
}

function replaceFeedClick(targetQuery) {
  return function() {return byReplaceFeedClick(targetQuery);};
}

var action = getAction();
if (action) {
  var timeouts = [500, 1000, 2000];
  for (var i = 0; i < timeouts.length; i++)
    setTimeout(action, timeouts[i]);
}