Drafts用goScrapbox
code:goScrapbox.js
goScrapbox
const homeUrl = 'https://scrapbox.io/rashitamemo/';
const tag = "";
const itemList = [];
itemList.push('「どうせ記事にしきれないメモたち」の供養祭');//固定ページへの追記
itemList.push('新規');//一行目をタイトルにしてページを作る
itemList.push('日記');//その日の日記ページに追記(存在なければ新規作成)
p = Prompt.create();
p.title = "?";
for(i=0; i<itemList.length; i++) p.addButton(itemListi);
p.show();
s = p.buttonPressed;
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth()+1;
const date = now.getDate();
const dateT = "日","月","火","水","木","金","土";
const day = dateTnow.getDay();
const hours = now.getHours();
const minutes = now.getMinutes();
const seconds = now.getSeconds();
text = editor.getText();
lines = text.split(/\r\n|\r|\n/);
if (s == itemList0){
url = homeUrl + encodeURIComponent(s) + "?body=" + encodeURIComponent(text);
}else if (s == itemList1){
title = lines0 == "" ? "無題ノート" : lines0.trim()
url = homeUrl + encodeURIComponent(title) + "?body=" + encodeURIComponent(text + tag);
}else if (s == itemList2){
diaryTitle = year + "/" + month + "/" + date;
url = homeUrl + encodeURIComponent(diaryTitle) + "?body=" + encodeURIComponent(text + tag) ;
}
app.openURL(url);
editor.focus();