Amazon商品ページをスクラップするBookmarklet
code:js
javascript:(function(){ var p = document.getElementById("productTitle"); if (!p) var p = document.getElementById("ebooksProductTitle"); var title=window.prompt('Scrap "Amazon" to your scrapbox.', p.innerHTML); if (!title) return; title = '%E3%80%8E'+ title +'%E3%80%8F'; var imagecontainer=document.getElementById("imageBlockContainer"); if (!imagecontainer) var imagecontainer = document.getElementById("ebooksImageBlockContainer"); var image = imagecontainer.getElementsByTagName("img")0; var imageurl = image.getAttribute("src"); var pub = []; var c = document.getElementsByClassName('author'); for (g=0; g < c.length ;g++){ let at = cg.innerText.replace(/,/,''); let pu = at.match(/\(.+\)/); let ct = at.replace(/\(.+\)/,'').replace(/ /g,''); pub.push('#' + ct); } var lines=pub.join(' ') + ' #book\n\n'+imageurl+' '+window.location.href+'\n'; var body=encodeURIComponent(lines); window.open('https://scrapbox.io/akibako/'+encodeURIComponent(title.trim())+'?body='+body) })();