Let’s search inside web pages

たいていのブラウザに組み込みのページ内検索機能があり、Chromeにもある。ただし、ブラウザがもっと小規模なアプリケーションだった頃からある機能のせいか微妙に素朴な動きしかしてくれない。例えば標準で正規表現が使えると嬉しいのだけど、できない。ページの密度が高くなってくると単に色でハイライトされたキーワードを見つけづらかったりするのも不便。検索ダイアログをEscapeでしか閉じられないのもめんどう。

そこで必要な機能を備えた拡張を作るかということになる。もちろん正規表現でページ検索できる拡張はすでにたくさんあるのだが…例えば現代だとそこかしこに絵文字が使われてるわけだが、最新の絵文字は複数のコードポイントから形成されてたりする。つまり検索を行う拡張側でも正確な書記素クラスタの認識ができないとハイライト処理などが盛大に壊れたりする可能性があり…実際いくつか試してみたところ盛大に壊れる。

また、正規表現によるページ内検索を実装する場合、要素を走査して要素ごとに検索を行う場合とそれ以外が考えられる。前者だと パンケーキとどら焼きって<b>ぶっちゃけ同じ</b>だよね のようなテキスト全体を検索することができない。既存の拡張は、全て試したわけではないが、だいたい半々くらいに分けられると思う。シンプルな実装の方が堅牢だし応答もよいだろうから明確に優劣があるわけではないのだが、まあできるのなら要素をまたいだ検索が可能な方がよい。

ついでに言うと migemo 検索ができると若干嬉しい。若干というのは、Chrome で migemo 検索というのは10年くらい前にはそういう拡張があったのだが、知らないうちに公開停止になっていて、しかもそれが特に話題にもなってないっぽくて、特に代替の拡張も登場しないまま10年経っているという現実が引っかかるからである。要するに非常にニッチにしか刺さらなくて、あんまり広い需要はないし売りにもならないのかもしれない。まあ個人的にはあれば嬉しい。

以上の要件を勘案すると、じゃあ新しいの作るかーということになる。

* * *

というわけで、作った

One thought on “Let’s search inside web pages

  1. Dear fashionistas and fashionistas We invite you to an unforgettable trip to Istanbul a city where Eastern traditions and Western style merge. In this amazing city you can update your wardrobe with luxurious fur coats and sheepskin coats from the best manufacturers Our tour includes visits to famous markets and boutiques where you will find not only high quality but also exclusive models at competitive prices. We will help you make the right choice tell you about the latest fashion trends and tell you how to choose the perfect fur thing. In addition to shopping you can enjoy the unsurpassed culture of Istanbul: excursions to historical sites flexible schedules and delicious local cuisine — all this will make your trip unforgettable. Dont miss the chance to update your wardrobe while enjoying the unique atmosphere of this magical city We are waiting for you at the start of our unforgettable adventure in Istanbul 22e76f2

Leave a Reply

Your email address will not be published. Required fields are marked *