Mastodon の長いトゥートを置換するやつ

長すぎてびっくりするトゥートを好きな文字に置換します。デフォルトでは https://mstdn.jp で動作しますが、@matchタグを追加して他のインスタンスで動作させることもできます。

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Аўтар
Eskey Easy
Усталяванняў за дзень
0
Усяго ўсталяванняў
4
Рэйтынг
0 0 0
Версія
0.11
Створаны
13.02.2023
Абноўлены
14.02.2023
Памер
2.7 КБ
Ліцэнзія
MIT
Ужываецца на

インスタンスについて

デフォルトでは https://mstdn.jp で動作します。どこで動作させるかは、 @match タグで定義します。下記のような行を探して、書き換えるか行を追加してください。

// @match        https://mstdn.jp/web/**

設定項目について

置換対象の長さ、置換テンプレート、チェック間隔はプログラム内で変更できます。

    /**
      これより長いトゥートは REPLACED_HTML に置換される。リンクとハッシュタグは無視される。
      The toots that is longer than this number will be replaced into REPLACED_HTML.
      URLs and hashtags are not counted.
    */
    const TEXT_LENGTH_THRESHOLD = 200;

    /**
      置換テンプレート。"${textLen}"とすると文字数に置換される。
      The long toots will be replaced into this HTML. "${textLen}" represents the length of toot.
      example: `${length}文字` → "300文字"
    */
    const REPLACER = (original, length) => `${length}文字`;

    /**
      更新間隔。ミリ秒
      Check interval(milliseconds)
    */
    const TOOT_CHECK_INTERVAL_MS = 60;