Amazonの書誌情報をCosenseに登録する
Amazonの書誌情報をCosenseに登録する
そのため、ブックマーク機能のところに直接コードを登録すればいい
コードの一部を書誌情報を登録したいCosenseプロジェクトに名前を変更する必要がある
今回は この公開練習場プロジェクトに登録したいので、practicefieldに変更した
以下がコード。もしブラウザを変えた時はこのコードを登録すればいい。
code:Amazonの書誌情報を登録する
javascript:(function(){var p=document.getElementById("productTitle");if(!p)p=document.getElementById("ebooksProductTitle");var t=window.prompt('Scrap "Amazon" to your scrapbox.',p.innerText.trim());if(!t)return;t='%E3%80%8E'+t+'%E3%80%8F';var a=document.getElementById('ASIN');if(a){var i='ISBN:'+a.value;}else{a=document.getElementsByName('ASIN.0')0,i='ASIN:'+a.value;}var d=document.getElementById('detailBullets_feature_div');if(!d){var s=document.getElementById("product-description-iframe").contentWindow.document;d=s.getElementById("productDetailsTable");}var l=d.innerText;var u=l.match(/(%E5%87%BA%E7%89%88%E7%A4%BE : .+) (\(.+\))/);if(u){u1=u1.replace(/: /,":[");u1=(u1.match(/;/)?u1.replace(/;/,%22];%22):u1.trim()+%22]%22);u2=u2.replace(/\((\d+\/\d+)\//,%22($1/%22)+%22%20%22;}else{u=%27%27,%27%27,%27%27;}var%20b=document.getElementById(%22bookDescription_feature_div%22);if(b){if(b.innerText==%22%22){var%20e=document.getElementById(%22editorialReviews_feature_div%22);if(e)c=e.innerText.replace(/\n/g,%22\n%3E%22);}else{var%20c=b.innerText.replace(/\n/g,%22\n%3E%22).replace(%22%E7%B6%9A%E3%81%8D%E3%82%92%E8%AA%AD%E3%82%80%22,%22%22);}}else{var%20o=document.getElementById(%22productDescription_feature_div%22);if(o){var%20n=document.getElementsByClassName(%22pInfoTabCExpander-content%22);var%20c=n0.innerText.replace(/\n/g,%22\n%3E%22);}}var%20m=document.getElementById(%22landingImage%22);if(!m)m=document.getElementById(%22ebooksImgBlkFront%22);var%20r=m.getAttribute(%22src%22);var%20v=[];var%20g=document.getElementsByClassName(%27author%27);for(h=0;h%3Cg.length;h++){var%20y=gh.innerText.replace(/\r?\n/g,%27%27).replace(/,/,%27%27);var%20q=y.match(/\(.+\)/);var%20j=y.replace(/\(.+\)/,%27%27).replace(/%20/g,%27%27);v.push(q+%27%20%27+j.trim()+%27%27);}var%20w=%27%27+r+%27%20%27+window.location.href+%27\n%27+v.join(%27%20%27)+%27\n%27+u1+u2+i+%27\n%3E%27+c+%27\n#%E6%9B%B8%E7%B1%8D%E5%90%8D\n';var%20k=encodeURIComponent(w);window.open('https://scrapbox.io/practicefield/'+encodeURIComponent(t.trim())+'?body='+k);})(); 参考