F-List Profile Stripper

Adds a button to strip most formatting information from an F-List profile description.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         F-List Profile Stripper
// @namespace    tag:[email protected],2018-02-25:F-ListProfileStripper
// @version      1.0
// @description  Adds a button to strip most formatting information from an F-List profile description.
// @author       Cummy
// @match        https://www.f-list.net/c/*
// @grant        none
// ==/UserScript==
(function () {
    'use strict';

    var profileDescription = document.getElementsByClassName("FormattedBlock")[0];
    var savedInnerHTML = profileDescription.innerHTML;

    var button = document.createElement('button');
    button.innerHTML = 'Strip formatting';
    button.onclick = function() {
        var images = document.getElementsByClassName("FormattedBlock")[0].getElementsByTagName("img");
        while (images.length > 0) { images[0].parentNode.removeChild(images[0]); }

        var childElements = document.getElementsByClassName("FormattedBlock")[0].getElementsByTagName("*");
        for (var i = 0; i < childElements.length; i++) { childElements[i].className = ''; childElements[i].style = ''; }

        button.replaceWith(restoreButton);
    };

    var restoreButton = document.createElement('button');
    restoreButton.innerHTML = 'Restore formatting';
    restoreButton.onclick = function() {
        profileDescription.innerHTML = savedInnerHTML;
        restoreButton.replaceWith(button);
    };

    profileDescription.parentNode.insertBefore(button, profileDescription);
})();