概要
タイトルが「?」で終わるものは質問データ
それ以外は解答候補データ
このページのscript.jsを自分のページにコピーすると、Ctrl-Cで問題作成モード(EpisoQ)に入れるようになります
「自分のページ」は右上メニューから設定できます
正解を選択して「HTML生成」ボタンを押すと問題HTMLを作成できます
https://s3-ap-northeast-1.amazonaws.com/masui.org/b/3/b36d0a39d1d607afeb2077b9f60675c6.html https://gyazo.com/7f6e2b3c94e8439ef5093e3f51fb3ff8
EpisoPass用UserScript
code:script.js
var nquestions = 10;
async function episoq() {
var questions = []
var answers = []
var project = scrapbox.Project.name
var res = await fetch('/api/users/me')
var data = await(res.json())
var username = data.name
res = await fetch(/api/pages/${project}?limit=1000);
data = await res.json();
data.pages.forEach ( page => {
var title = page.title
if(title.match(/^_/) || title.match(/_$/) || title == username || title == 'settings' || page.pin != 0){
}
else {
if(title.match(/\?$/)){
questions.push(title)
}
else {
page.descriptions.forEach ( description => {
if(description.match(/^\d(\d+)$/)){
title = description + ' ' + title;
}
})
answers.push(title)
}
}
})
answers = answers.sort().map ((e) => e.match(/^(\w+\s+)?(.*)$/)2 ) var qstr = questions.sort(() => 0.5 - Math.random()).slice(0,nquestions).join(';')
var astr = answers.join(';')
location.href = http://episopass.com/?questions=${qstr}&answers=${astr}&n=${nquestions}
}
document.addEventListener('keydown', e => {
if (e.key == 'c' && e.ctrlKey){ // Ctrl-Cで実行
nquestions = Number(window.prompt('問題の数を指定してください','10'))
if (nquestions != 0){
episoq()
}
}
})