« Atom 0.4 | トップページ | 舞-HiME 第1巻(こうさぎ) »
2005.01.18
Technorati tags MenuExt / 右クリックで Technorati の tag はりつけ
ブログの記事の編集画面に、tag にしたい文字列を空白文字で区切って列挙しておいてから、それをマウスで選択、右クリックで本スクリプトを起動すると、Technorati の tag に変換されます。
ネタ元(参考にしたブックマークレット): Technorati Tags Bookmarklet
例えば、
Technorati tag 右クリック MenuExt
という文字列をマウスで選択して、本スクリプトを起動すると
<span class="technoratitag">Technorati Tags: <a href="http://www.technorati.com/tags/Technorati" rel="tag">Technorati</a>, <a href="http://www.technorati.com/tags/tag" rel="tag">tag</a>, <a href="http://www.technorati.com/tags/%E5%8F%B3%E3%82%AF%E3%83%AA%E3%83%83%E3%82%AF" rel="tag">右クリック</a>, <a href="http://www.technorati.com/tags/MenuExt" rel="tag">MenuExt</a></span>
つまり
Technorati Tags: Technorati, tag, 右クリック, MenuExt
に変換されます。
それではスクリプトのソースです。このスクリプトを設置するときの contexts の値は 37 (バイナリ) にしてください。
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
<SCRIPT language="JavaScript" type="text/javascript">
function setSelection(v) {
if ( str )
obj.document.selection.createRange().text = v;
}
obj = external.menuArguments; // 右クリック時の引数オブジェクト
str = obj.document.selection.createRange().text; // 選択されている文字列
var a = '';
if ( (str == "") || (str == "[object]") )
str = prompt('Enter Tags:','');
var tr = str.split(' ');
a += '<span class=' + unescape('%22') + 'technoratitag' + unescape('%22') + '>Technorati Tags: ';
for ( var i = 0; i < tr.length; i++ ) {
if ( i > 0 )
a += ', ';
a += '<a href=' + unescape('%22') + 'http://www.technorati.com/tags/' + encodeURIComponent(tr[i]) + unescape('%22') + ' rel=' + unescape('%22') + 'tag' + unescape('%22') + '>' + tr[i] + '</a>';
}
a += '</span>';
setSelection(a);
</SCRIPT>
関連記事: Technorati の tag、 Technorati Hack #2、 tag
投稿者: tsupo 2005.01.18 午後 07:53
| 固定リンク
|
|
| ![]()
|
|
アマゾンわくわく探検隊
トラックバック
この記事のトラックバックURL:
この記事へのトラックバック一覧です: Technorati tags MenuExt / 右クリックで Technorati の tag はりつけ:



