ブログ編集中に使えるMMのタグ自動抽出API用bookmarklet…

があれば確かに便利かもしれないと思い、作ってみた。


そのページの一つ目のtextarea内のテキストを、iframeで取得して、iframeのonloadでtextarea内に追記してやればいいかなと思ったんだけど、

javascript:(function(){var d=document;var e=d.getElementsByTagName('textarea')[0];if(!e)return;var f=d.createElement('iframe');f.id='mm-getwords';f.onload=function(e,d){var w=this.contentWindow||d.frames[this.id];if(!w)return;e.innerHTML+=w.document.body.innerHTML;};f.src='http://1470.net/api/mmutil.php?cmd=getwords;charset=utf-8;text='+encodeURIComponent(e.value);d.documentElement.appendChild(f);})()

これ↑だとonload部分が動かず。orz

Firefox1.0.6のJavaScriptコンソールは:

エラー: uncaught exception: HTMLDocument.body ×íÑÆ£n­ÖŠ)PLBŠ~[“

意味不明…。document.framesじゃないのかな。うーむ。

    • -

抽出語取得までは上手くいっているんだけどなあ。

タグ タグ自動 getElementsByTagName encodeURIComponent documentElement contentWindow HTMLDocument createElement javascript appendChild bookmarklet テキスト プラグイン プラグ ブログ ページ ×£ × ただ 一つ