Amazon.co.jp の商品ページに .com の同一商品へのリンクを追加する Greasemonkey スクリプトを書いた。洋書のレビューや価格を調べるときに便利。元ネタは会社の上司。
AddAmazonDotCom.user.js
// ==UserScript== // @name Add Amazon.com URL // @namespace http://bitmap.dyndns.org/ // @description Add Amazon.com URL // @include http://www.amazon.co.jp/* // @include http://amazon.co.jp/* // ==/UserScript== (function() { try { var matches = location.href.match(new RegExp("(http://(www.)?amazon\.)(co\.jp)(/.*)")); var html = "<br><a href='" + matches[1] + "com" + matches[4] + "'>この商品をAmazon.comで見る</a>" document.getElementById("btAsinTitle").innerHTML += html; } catch (e) { } })();
ついでに、Amazon.com で商品の値段に円へレート変換するリンクを貼るスクリプトも書いた。
AmazonDotComDollarExchange.user.js
// ==UserScript== // @name Add Exchange Links // @namespace http://bitmap.dyndns.org/ // @description Add Exchange Links // @include http://www.amazon.com/* // ==/UserScript== (function() { try { var html = document.getElementById("priceBlock").innerHTML; html = html.replace(/(\$[0-9,]+\.\d+)/g, "<a href='http://www.google.co.jp/search?hl=ja&q=$1+in+yen'>$1"); document.getElementById("priceBlock").innerHTML = html; } catch (e) { } })();