Last active
February 27, 2018 12:09
-
-
Save masaakif/2156093 to your computer and use it in GitHub Desktop.
Add Media Maker link on Amazon page
This file contains hidden or 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 Media Maker | |
| // @namespace http://gist.github.com/2156093 | |
| // @description Add item to Media Maker | |
| // @include http://*.amazon.* | |
| // ==/UserScript== | |
| // Version 20100312 | |
| var DEBUG=true; | |
| addLinkToMediaMaker(); | |
| function addLinkToMediaMaker() { | |
| 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 == undefined) { | |
| header = document.evaluate("//div[@class='buying']//a[contains(@id, 'contribut')]", 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://mediamarker.net/u/masaakif/reg?cat=1&asin=' + asin ); | |
| spl_link.setAttribute('title', 'Register to MediaMarker'); | |
| spl_link.setAttribute('target', '_blank'); | |
| spl_link.innerHTML = ' <span style=\"font-size:90%; background-color:#ebf2cc;\">»MediaMarkerに登録</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