// ? Meta-Bookmark Finder, released under the GPL
// http://www.gnu.org/copyleft/gpl.html
//
// ==UserScript==
// @name           Hatena Meta-Bookmark Finder
// @description    Adds a pointer to the meta-bookmark.
// @include        http://b.hatena.ne.jp/entry/*://*
// ==/UserScript==
//
// 2008-11-25 (v0.2) Added modifications to support the new site design (http://hatena.g.hatena.ne.jp/hatenabookmark/20081125/1227602284).
// 2008-03-01 (v0.1) Initial Version.

(function(){
  var targetNode = document.evaluate('id("entryinfo")/DIV/TABLE/TBODY', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

  if (!targetNode) {
    return;
  }

  var tr = targetNode.insertBefore(document.createElement('TR'), targetNode.lastChild.previousSibling);
  var th = tr.appendChild(document.createElement('TH'));
  var td = tr.appendChild(document.createElement('TD'));
  var a = td.appendChild(document.createElement('A'));
  var img = a.appendChild(document.createElement('IMG'));

  th.appendChild(document.createTextNode('\u30e1\u30bf\u30d6\u30c3\u30af\u30de\u30fc\u30af:'));
  a.href = 'http://b.hatena.ne.jp/entry/' + location.href;
  img.src = 'http://b.hatena.ne.jp/entry/image/' + location.href;
})()

