// ==UserScript== // @name ShowAmazonProductShortURL // @namespace http://blog.kaihatsubu.com/ // @description double click to show product URL // @include http://www.amazon.co.jp/* // ==/UserScript== (function() { document.addEventListener("dblclick", function(event) { var baseURL = "http://www.amazon.co.jp"; var patternA = /\/dp\/[^/]+/; var patternB = /\/gp\/product\/[^/]+/; if (location.toString().match(patternA)) { alert(baseURL + location.toString().match(patternA)[0]); } else if (location.toString().match(patternB)) { alert(baseURL + location.toString().match(patternB)[0]); } }, false); })();