Skip to content

Instantly share code, notes, and snippets.

@Nyoho
Created February 3, 2016 06:15
Show Gist options
  • Save Nyoho/6d9da48847d81dd53cbe to your computer and use it in GitHub Desktop.
Save Nyoho/6d9da48847d81dd53cbe to your computer and use it in GitHub Desktop.
Amazon.co.jpの書籍情報をコピーするときに便利なブックマークレット
javascript:(function()%7Bvar%20a=document.getElementById('booksTitle').innerText;var%20b=document.getElementsByClassName('bucket');for(i=0;i<b.length;i++)if(/登録情報/i.test(b[i].innerHTML))var%20r='■%20'+a+b[i].innerText;r=r.replace(/おすすめ[\s\S]*らせる\n/,'');b=document.getElementsByTagName('b');for(i=0;i<b.length;i++)if(/ISBN-10/i.test(b[i].innerHTML))is=b[i].parentNode.innerHTML.match(/(\d{10})/);var%20e=document.createElement('textarea');e.style.width='100%25';e.value=r+'http://www.amazon.co.jp/dp/'+is[1]+'/\n';document.body.insertBefore(e,document.body.firstChild);e.focus();e.select();e.ondblclick=function()%7Be.parentNode.removeChild(e);%7D;e.oncopy=function()%7BsetTimeout(function()%7Be.parentNode.removeChild(e);%7D,1);return%20true;%7D%7D)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment