formatting
動画情報を取り込むscript
2020/9/2 11:39 no longer used
code:script.js
javascript: (async ()=> {
const projectName = 'taberungo';
const ng = text => text.trim().replace(/[\\\n]/g, ' '); // titleに含まれる[]や改行を取り除くlambda式 const e = t => encodeURIComponent(t);
const list = await fetch(/api/pages/${projectName}/taberungo-list26/text)
.then(res => res.text())
.then(text => text.split('\n'));
const openNewPage = (j)=>{
const title=e(ng(listj)); const zero = n => String(n).padStart(2, '0');
const format = d => ${d.getFullYear()}-${zero(d.getMonth() + 1)}-${zero(d.getDate())};
const body = ${list[j+1]}\n${list[j+2]}\n${list[j+3]}\n${list[j+4]};
//作成
window.open(https://scrapbox.io/${projectName}/${title}?body=${e(body)},"_blank");
}
// タイトルは読み飛ばす
for(let j = 1; j < list.length; j+=5) {
openNewPage(j);
}
})();
2020-08-12