Skip to content

Instantly share code, notes, and snippets.

@masaakif
Created December 19, 2008 00:10
Show Gist options
  • Save masaakif/37725 to your computer and use it in GitHub Desktop.
Save masaakif/37725 to your computer and use it in GitHub Desktop.
// ==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;\">&raquo;&#35501;&#26360;&#12513;&#12540;&#12479;&#12540;&#12408;&#12398;&#12522;&#12531;&#12463;</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;\">&raquo;&#35501;&#12415;&#12383;&#12356;&#26412;&#12395;&#36861;&#21152;</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