Elm の記事からヤギ画像を取り除く User Script を書いた

Elm とヤギ画像

Elm というプログラミング言語があって面白そうだなと思っているのだけれど、まぁ何というか、個人的にはアレだなーと思うところもあって。

ということで、User Script 書いてみた。

User Script

最近あまり聞かなくなった気がするけれど以前、Greasemonkey というものがあって、それの Chrome 版として Tampermonkey という拡張があった。

で、以下のスクリプトを登録することで目的を達成できた。

Qiita

// ==UserScript==
// @name         removeGoatQiita
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to remove images of goat
// @author       ryskosn
// @match        https://qiita.com/arowM/items/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const imgs = document.getElementsByClassName('it-MdContent')[0].getElementsByTagName('img');
    for (const img of Array.from(imgs)) {
        img.parentNode.removeChild(img);
    }
})();

ちょっと雑かもしれないけれど、他のやり方が思いつかなかった。

elm-lang.jp

// ==UserScript==
// @name         removeGoatElmLangJp
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to remove images of goat
// @author       ryskosn
// @match        https://elm-lang.jp
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const eyeCatch = document.getElementsByClassName('eyeCatch')[0];
    const moment = document.getElementsByClassName('moment')[0];
    eyeCatch.parentNode.removeChild(eyeCatch);
    moment.parentNode.removeChild(moment);
})();

それぞれのスクリプトを Tampermonkey のダッシュボードから設定する。

Image from Gyazo