Last active
August 29, 2015 14:16
-
-
Save CzBiX/63d226cc09cc85c3031f to your computer and use it in GitHub Desktop.
Amazon to CN
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 Amazon to CN | |
// @namespace CzBiX | |
// @include http://www.amazon.com/* | |
// @version 2 | |
// @grant unsafeWindow | |
// ==/UserScript== | |
var window = unsafeWindow; | |
var $ = window.jQuery; | |
if (typeof $ === 'undefined') { | |
// maybe not product page, ignore it | |
return; | |
} | |
var link = $('link[rel="canonical"]')[0].href; | |
var asin = link.substr(link.indexOf('/dp/')); | |
var cnLink = 'http://www.amazon.cn' + asin; | |
var topBar = $('#nav-cross-shop-links'); | |
topBar.append('<a target="_blank" href="' + cnLink + '">In China</a>'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment