イントラネットで短縮URLサービスlilurlを手軽に活用するためのブックマークレットを作った

今見ているページの短縮URLの発行をlilurlにリクエストするためのブックマークレットを作ってみた。
このブックマークレットを使うためには以下のハックを適用していることが前提となる

Firefox用とIE用を作った。確認してないけどもしかしたら、Firefox用はOperaとかChromeとかでも動くかもしれない。

Firefox

javascript:
var req = new XMLHttpRequest();
req.open('GET', 'http://lilurl_server/lilurl/index.php?longurl=' + location, false);
req.send(null);
if(req.status == 200) {
  prompt('Copy this', req.responseText);
  void(0);
}

IE

javascript:
var req = new ActiveXObject('Microsoft.XMLHTTP');
req.open('GET', 'http://lilurl_server/lilurl/index.php?longurl=' + location, false);
req.send(null);
if(req.status == 200) {
  window.clipboardData.setData('Text', req.responseText);
  alert('Copy to clipboard:' + req.responseText);
  void(0);
}

IE用はクリップボードへのコピーまでやってくれるので、ほんとにワンタッチ。
これでlilurlがずいぶんと使いやすくなるはず。