書誌情報登録のブックマークが動かない場合
Cosense経由でブックマークを動かしているときに、機能しなくなったらCORPの影響の可能性がある
これはスクリプトレベルでは解決できない(他のWebサイトの情報は使えませんよ、という制限が働いている)
その際は、スクリプトの中身を直接登録すれが解決する
本来は、これがブックマークレットの普通の使い方
ブックマークを編集し、URL欄に以下のスクリプトをコピペする
https://gyazo.com/c1f4f268a2fe607e9cc921273be101f2
下記の保存先のプロジェクトは倉下のものになっているので、最後の方にあるrashitaobjを自分のプロジェクト名に差し替える。
このプロジェクトならば、BCBookReadingCircleとなる。
code:script_min.js
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='『'+t+'』';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(/(出版社 : .+) (\(.+\))/);if(u){u1=u1.replace(/: /,":[");u1=(u1.match(/;/)?u1.replace(/;/,"];"):u1.trim()+"]");u2=u2.replace(/\((\d+\/\d+)\//,"($1/")+" ";}else{u='','','';}var b=document.getElementById("bookDescription_feature_div");if(b){if(b.innerText==""){var e=document.getElementById("editorialReviews_feature_div");if(e)c=e.innerText.replace(/\n/g,"\n>");}else{var c=b.innerText.replace(/\n/g,"\n>").replace("続きを読む","");}}else{var o=document.getElementById("productDescription_feature_div");if(o){var n=document.getElementsByClassName("pInfoTabCExpander-content");var c=n0.innerText.replace(/\n/g,"\n>");}}var m=document.getElementById("landingImage");if(!m)m=document.getElementById("ebooksImgBlkFront");var r=m.getAttribute("src");var v=[];var g=document.getElementsByClassName('author');for(h=0;h<g.length;h++){var y=gh.innerText.replace(/\r?\n/g,'').replace(/,/,'');var q=y.match(/\(.+\)/);var j=y.replace(/\(.+\)/,'').replace(/ /g,'');v.push(q+' '+j.trim()+'');}var w=''+r+' '+window.location.href+'\n'+v.join(' ')+'\n'+u1+u2+i+'\n>'+c+'\n#書籍名\n';var k=encodeURIComponent(w);window.open('https://scrapbox.io/rashitaobj/'+encodeURIComponent(t.trim())+'?body='+k);})();