Created
December 19, 2008 00:10
-
-
Save masaakif/37725 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Dokusyo meter | |
// @namespace http://gist.github.com/37725 | |
// @description Link to Dokusyo meter | |
// @include http://*.amazon.* | |
// ==/UserScript== | |
// Version 20070301 | |
var DEBUG=true; | |
addLinkToDokusyo(); | |
function addLinkToDokusyo() { | |
var val = document.getElementById("ASIN").value; | |
if (val!=''){ | |
var asin = val; | |
var header = document.evaluate("//div[@class='buying']/a", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
if (header) { | |
// Link to dokusyo meter | |
var spl_link = document.createElement('a'); | |
spl_link.setAttribute('href', 'http://book.akahoshitakuya.com/b/' + asin ); | |
spl_link.setAttribute('title', 'Link to Dokusyo Meter'); | |
spl_link.setAttribute('target', '_blank'); | |
spl_link.innerHTML = ' <span style=\"font-size:90%; background-color:#ffffcc;\">»読書メーターへのリンク</span><br>'; | |
header.parentNode.insertBefore(spl_link, header); | |
// Add to wish list | |
/* | |
var spl_wishlist_link = document.createElement('a'); | |
spl_wishlist_link.setAttribute('href', 'http://book.akahoshitakuya.com/add.php?ean=&isbn=' + asin + '&asin=' + asin + '&image=&type=pre' ); | |
spl_wishlist_link.setAttribute('title', 'Add reading list'); | |
spl_wishlist_link.setAttribute('target', '_blank'); | |
spl_wishlist_link.innerHTML = ' <span style=\"font-size:90%; background-color:#ffffcc;\">»読みたい本に追加</span><br>'; | |
header.parentNode.insertBefore(spl_wishlist_link, header); | |
*/ | |
} | |
} | |
} | |
function debug() { | |
if ( typeof DEBUG != 'undefined' && DEBUG ) { | |
console.log.apply(this, arguments) | |
} | |
} | |
function getTitle(document) | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment