(function(){
const root=document.querySelector(‘[data-practice=”pharmacy”]’);
if(!root) return;
const data={“words”:[[“약국”,”yak-guk”,”pharmacy”,”Place to buy medicine.”,”약국이 어디예요?”],[“감기약”,”gam-gi-yak”,”cold medicine”,”Medicine for cold symptoms.”,”감기약 주세요”],[“기침”,”gi-chim”,”cough”,”Coughing symptom.”,”기침이 나요”],[“콧물”,”kon-mul”,”runny nose”,”Nasal symptom.”,”콧물이 나요”],[“목”,”mok”,”throat”,”Throat in this context.”,”목이 아파요”],[“열”,”yeol”,”fever”,”High body temperature.”,”열이 있어요”],[“두통”,”du-tong”,”headache”,”Head pain.”,”두통이 있어요”],[“처방전”,”cheo-bang-jeon”,”prescription”,”Doctor’s medicine order.”,”처방전 있어요”],[“복용”,”bo-gyong”,”taking medicine”,”Dosage or usage.”,”복용 방법”],[“식후”,”sik-hu”,”after meals”,”Take after eating.”,”식후에 드세요”],[“졸려요”,”jol-lyeo-yo”,”sleepy”,”Causes drowsiness.”,”이 약 졸려요?”],[“알레르기”,”al-le-reu-gi”,”allergy”,”Allergy information.”,”알레르기 있어요”]],”situations”:[[“You have a cough. Which Korean phrase works?”,”기침이 나요”,[“기침이 나요”,”식후에 드세요”,”처방전 있어요”,”알레르기 있어요”],”기침이 나요 means I have a cough.”],[“The pharmacist says 식후에 드세요. When should you take it?”,”after meals”,[“before sleeping”,”after meals”,”with coffee”,”only once”],”식후 means after meals.”]]};
let flash=0, mc=0, spell=0, sit=0, score=0, total=0, missed=[];
const $=(sel)=>root.querySelector(sel);
function showFlash(){
const w=data.words[flash % data.words.length];
$(‘.flash-word’).textContent=w[0];
$(‘.flash-roman’).textContent=w[1];
$(‘.flash-meaning’).textContent=’Click “Show Meaning” to check yourself.’;
$(‘.flash-example’).textContent=w[4];
}
function showMeaning(){
const w=data.words[flash % data.words.length];
$(‘.flash-meaning’).textContent=w[2]+’ – ‘+w[3];
}
function nextFlash(){ flash++; showFlash(); }
function makeOptions(answer, source){
const pool=source.filter(v=>v!==answer).sort(()=>Math.random()-0.5).slice(0,3);
return [answer,…pool].sort(()=>Math.random()-0.5);
}
function updateScore(){ $(‘.score’).textContent=score+’ / ‘+total; $(‘.missed’).innerHTML=missed.length?missed.map(m=>’