LoginSignup
2
3

More than 5 years have passed since last update.

MTG WikiのWisdom GuildへのリンクをWiki内部にするユーザースクリプト

Posted at

MTG Wikiの水色背景で書かれるカード説明。
そのカード名リンクはカード単体へのリンクではなくWisdom Guildへのリンクになっている。
デッキ集などのキーカード紹介では直感的にそのカードのリンクへ飛べなく、DCG(アリーナ)プレイヤーには正直Wisdomは不要なのでリンクを書き換える。

// ==UserScript==
// @name         MtG Wiki wisdom to wiki link
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://mtgwiki.com/wiki/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  const URL = 'http://mtgwiki.com/wiki/'
  document.querySelectorAll('a.external[href^="http://whisper.wisdom-guild.net/card/"]').forEach(a => {
    let text = a.textContent
    let names = text.split('/').map(name => {
      return name.trim().replace(' ', '_')
    })
    a.href = URL + names[1] + '/' + names[0]
    //console.log(names)
  })
})();

カード名をURLに変換しているので、分割カードなど特殊には未対応

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3