ACMDLからUIPedia登録Tampermonkeyスクリプト
code:script.js
// ==UserScript==
// @name UIPedia登録
// @version 2024-07-16
// @description ACM Digital LibraryからUIPediaに登録
// @author 増井俊之
// @run-at context-menu
// @grant none
// ==/UserScript==
(function() {
'use strict';
(async () => {
const url = location.href;
const m = url.match(/acm\.org.*doi\/((.*)\/(.*))$/);
if(m == null) return;
"headers": {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
"referrer": https://dl.acm.org/doi/${doi},
"referrerPolicy": "strict-origin-when-cross-origin",
"body": dois=${doi}&targetFile=custom-endNote&format=endNote,
"method": "POST",
"mode": "cors",
"credentials": "include"
});
const json = await resp.json();
const entry = json.items0doi; const authors = entry.author;
const title = ${authors[0].given} ${authors[0].family}: ${entry.title};
var body = [];
body.push('タイトル');
body.push(encodeURI( [${entry.title} ${url}]));
body.push('著者');
for (const author of authors) {
body.push( [${author.given} ${author.family}]);
}
body.push('ソース');
body.push('年');
body.push('月');
body.push('ページ');
body.push(' '+entry.page);
body.push('概要');
body.push(' '+encodeURI(entry.abstract));
body.push('DOI');
body.push(' '+entry.DOI);
body.push('URL');
body.push(' '+entry.URL);
body.push('キーワード');
body.push(' '+entry.keyword);
body.push('出版社');
body.push(' '+entry.publisher);
body.push('内容');
body.push('コメント');
const title0 = title.replace(/\?/g,'%'+'3f').replace(/&/g,'%'+'26');
const body0 = body.join('%'+'0d').replace(/\?/g,'%'+'3f').replace(/\&/g,'%'+'26');
window.open(https://scrapbox.io/UIPedia/${title0}?body=${body0});
})();
})();