Skip to content

Instantly share code, notes, and snippets.

@razz0408
Forked from retlet/amazon_short_url.user.js
Last active January 16, 2022 04:52
Show Gist options
  • Save razz0408/f839ee34432edb15d8829e902d582cbd to your computer and use it in GitHub Desktop.
Save razz0408/f839ee34432edb15d8829e902d582cbd to your computer and use it in GitHub Desktop.
amazonのURLを短縮するgreasemonkeyスクリプト cf.http://d.hatena.ne.jp/Cherenkov/20080907/p1
// ==UserScript==
// @name amazon_short_url
// @namespace amazon_short_url
// @include https://www.amazon.co.jp/*
// ==/UserScript==
(function(){
const asin = document.getElementById('ASIN');
const title = document.getElementById('title_feature_div');
if(asin){
const link = document.createElement('a');
const url = 'https://www.amazon.co.jp/dp/'+asin.value;
link.setAttribute('href', url);
link.appendChild(document.createTextNode(url));
const add = document.getElementById('centerCol');
add.insertBefore(link, title);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment