javascript:(function(d,s){s=d.createElement('script');s.src='https://scrapbox.io/api/code/rtakaishi/bookmarklets/ob.js';d.body.appendChild(s);})(document)
javascript:(function(){
var p = document.getElementById("productTitle");//書籍のタイトルの処理
if (!p) var p = document.getElementById("ebooksProductTitle");
var title = p.innerText.trim();
var asin = document.getElementById('ASIN');//ASIN番号の処理
if(asin){
var a = asin.value;
}else{
var asin = document.getElementsByName('ASIN.0')[0],a = asin.value;
}
//登録情報欄を取得
var detail = document.getElementById('detailBullets_feature_div');
if (!detail) {
var subdoc = document.getElementById("product-description-iframe").contentWindow.document;
var detail = subdoc.getElementById("detailBullets_feature_div");
}
var detailtext = detail.innerText;
var pubdata = detailtext.split(/\n/);
pubdata[2] = pubdata[2].slice(10);//出版社
pubdata[1] = pubdata[1].slice(10);//出版社
//var publish = pubdata.filter(pubdata => detailtext.match(/\出版社/));
//var publisher = publish[0];//出版社
var url = 'https://www.amazon.co.jp/exec/obidos/ASIN/'+a+'/room510-22/';
var link = '['+title+']('+url+')';
- var image=document.getElementById("imgTagWrapperId");//書影の処理
- if (!image) var image = document.getElementById("ebooksImgBlkFront");
- var imageurl = image.querySelector("img").getAttribute("src");
- var pub = ;//著者情報の処理
- // 既存のコードを改善
- var c = document.getElementsByClassName('author');
- var pub = ;
- var ct\_list = ; // ctの各要素を保存する配列を新たに定義
- for (g = 0; g < c.length ;g++){
- var at = cg.innerText.replace(/\\r?\\n/g, '').replace(/,/,'');
- var pu = at.match(/\\(.+\\)/);
- var ct = at.replace(/\\(.+\\)/,'').replace(/ /g,'');
- ct\_list.push(ct); // ctを配列に追加
- pub.push(pu + ' **' + ct + '**');
- }
- // ct\_listを用いて新しいauthorの形式を生成
- var author\_list = ct\_list.map(function(ct, index) {
- return "- " + ct;
- }).join('%0A');
- var author = pub.join(' ');
- // 自分が必要なパラメータに変換
- var h1title = '『'+title+'』';
- if (/:|\\|\/|\?|"|<|>|\|\.|/.test(h1title)) {
- h1title = h1title.replace(/:/g, ':')
- .replace(/\\/g, '\')
- .replace(/\//g, '/')
- .replace(/\?/g, '?')
- .replace(/"/g, '”')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/\|/g, '|')
- .replace(/\./g, ' ');
- }
- var mdimage = '%0A!|100(' +imageurl+ ')%0A';
- // 表示させたい項目
- var lines= '---%0D%0Aauthor:%0A' + author_list + '%0D%0Adate%3A%0D%0Andl%3A%0D%0Atags%3A%20review%20%0D%0A---%0D%0A%0A' + link + mdimage + author +'%0A'+ pubdata + '%0A' + pubdata +'%0A%0A%23 関連・思い出した本 %0A%0A%23 読書メモ%0A%0A';
- var lines2 = '';
- const obsidian = 'obsidian://advanced-uri?vault=journals&filepath='+h1title+ '&data='+lines;
- window.open(obsidian);