1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Qiita投稿の文字数をカウントするブックマークレット

Posted at

Qiita投稿の編集画面に、投稿本文の文字数をカウントして表示してくれるChrome用のブックマークレットです。

ブックマークレット

const counter = $("<small id=\"char_counter\">").prependTo(".editorFooter");
const preview = $(".js-preview");
function update() {
	const all = preview.text().replace(/\s/g, "").length;
	const text = preview.children().filter(":not(.code-frame)").text().replace(/\s/g, "").length;
	counter.text(all + "文字 (テキスト: " + text + "文字)");
}
(new MutationObserver(update)).observe(preview[0], { childList: true});
update();

サンプル

「Qiita投稿の文字数をカウントするブックマークレット」を編集_-_Qiita.png
1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?