Liveloop

An interactive timeline for social media. Every post is a tiny app you can play, save, and remix.

Product

  • Feed
  • Create
  • Claude Code plugin
  • Blog

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • DMCA

Project

  • Templates
© 2026 Liveloop. All rights reserved.
LiveloopVersion history

v1Current

@daily_dose · 5/21/2026, 8:45:53 PM

Initial version — all lines are new.

+<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap" rel="stylesheet">
+<style>
+ *{box-sizing:border-box}
+ html,body{height:100%;margin:0}
+ body{font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#2a2320;background:#f4eee3;position:relative;overflow:hidden;-webkit-text-size-adjust:100%}
+ .orb{position:absolute;border-radius:50%;filter:blur(60px);opacity:.5;pointer-events:none}
+ .orb.a{width:200px;height:200px;background:#e7d9ff;top:-60px;left:-50px}
+ .orb.b{width:170px;height:170px;background:#ffd6bd;bottom:40px;right:-55px}
+ #wrap{position:relative;z-index:1;max-width:360px;margin:0 auto;height:100%;display:flex;flex-direction:column;padding:1rem .9rem;overflow:auto}
+ .hd{text-align:center;margin-bottom:.4rem}
+ .hd h2{margin:0;font-family:'Instrument Serif',Georgia,serif;font-weight:400;font-size:2rem;line-height:1}
+ .hd h2 em{font-style:italic;color:#6b4efe}
+ .hd p{margin:.35rem 0 0;font-size:.66rem;color:#8a817a;line-height:1.35}
+ .days{display:flex;gap:4px;margin:.7rem 0 .55rem}
+ .day{flex:1;padding:.5rem 0;border:0;border-radius:.7rem;background:rgba(255,255,255,.72);color:#5c544c;font-weight:600;font-size:.72rem;cursor:pointer;transition:.15s}
+ .day.active{background:#2a2320;color:#fff}
+ .add{display:flex;gap:.4rem;margin-bottom:.55rem}
+ .add input{flex:1;border:1px solid #e6ddcd;border-radius:.7rem;padding:.6rem .7rem;font-size:16px;background:#fff;color:#2a2320}
+ .add input:focus{outline:none;border-color:#6b4efe}
+ .add button{border:0;border-radius:.7rem;background:#6b4efe;color:#fff;font-weight:700;padding:0 1.05rem;cursor:pointer;font-size:.85rem}
+ .seclabel{font-size:.6rem;letter-spacing:.13em;text-transform:uppercase;color:#a89f95;font-weight:700;margin:.2rem 0 .4rem}
+ .chips{display:flex;flex-wrap:wrap;gap:.35rem;max-height:118px;overflow:auto;padding:.1rem .1rem .3rem}
+ .chip{border:1px solid #e6ddcd;background:#fff;color:#3a332e;border-radius:999px;padding:.34rem .62rem;font-size:.72rem;cursor:pointer;white-space:nowrap;transition:.12s;line-height:1}
+ .chip:active{transform:scale(.96)}
+ .chip.in{background:#efeafd;border-color:#cfc2fb;color:#6b4efe}
+ .chip .b{color:#a89f95;font-size:.66rem;margin-left:.18rem}
+ .empty-chip{font-size:.74rem;color:#a89f95;padding:.35rem .2rem}
+ .listlabel{display:flex;align-items:baseline;justify-content:space-between;margin:.85rem 0 .45rem}
+ .listlabel .seclabel{margin:0}
+ .listlabel .ct{font-size:.66rem;color:#a89f95;font-weight:600}
+ ul{list-style:none;margin:0;padding:0;flex:1 0 auto}
+ li{display:flex;justify-content:space-between;align-items:center;background:#fff;border-radius:.8rem;padding:.6rem .75rem;margin-bottom:.4rem;box-shadow:0 1px 6px rgba(42,35,32,.06)}
+ li .nm{flex:1;font-size:.86rem;display:flex;align-items:center;min-width:0}
+ li .dot{width:8px;height:8px;border-radius:50%;background:#6b4efe;margin-right:.55rem;flex-shrink:0}
+ li .b2{color:#a89f95;font-size:.7rem;margin-left:.35rem}
+ li.empty{justify-content:center;color:#a89f95;font-size:.82rem;box-shadow:none;background:transparent}
+ li .rm{border:0;background:transparent;color:#d6492f;font-size:1.05rem;cursor:pointer;padding:0 .15rem}
+ #saved{text-align:center;font-size:.7rem;color:#16a34a;min-height:1.1em;margin-top:.5rem;font-weight:700}
+ #saved.warn{color:#b45309}
+</style>
+<div class="orb a"></div><div class="orb b"></div>
+<div id="wrap">
+ <div class="hd">
+ <h2>Weekly <em>Pills</em></h2>
+ <p>Personal organizer — not medical advice. Saved to your account.</p>
+ </div>
+ <div class="days" id="days"></div>
+ <div class="add">
+ <input id="med" placeholder="Search or type a medication…" autocomplete="off">
+ <button id="addBtn">Add</button>
+ </div>
+ <div class="seclabel">Tap to add</div>
+ <div class="chips" id="chips"></div>
+ <div class="listlabel"><div class="seclabel" id="dayLabel">Monday</div><div class="ct" id="ct"></div></div>
+ <ul id="list"></ul>
+ <div id="saved"></div>
+</div>
+<script>
+ var MEDS=["Acetaminophen (Tylenol)","Ibuprofen (Advil)","Aspirin","Naproxen (Aleve)","Lisinopril","Atorvastatin (Lipitor)","Levothyroxine (Synthroid)","Metformin","Amlodipine","Metoprolol","Omeprazole (Prilosec)","Losartan","Albuterol","Gabapentin","Hydrochlorothiazide","Sertraline (Zoloft)","Simvastatin","Montelukast (Singulair)","Escitalopram (Lexapro)","Rosuvastatin (Crestor)","Bupropion (Wellbutrin)","Furosemide (Lasix)","Pantoprazole","Prednisone","Fluoxetine (Prozac)","Citalopram (Celexa)","Tramadol","Trazodone","Amoxicillin","Cyclobenzaprine","Duloxetine (Cymbalta)","Meloxicam","Pravastatin","Carvedilol","Tamsulosin (Flomax)","Venlafaxine (Effexor)","Allopurinol","Atenolol","Glipizide","Insulin","Warfarin (Coumadin)","Clopidogrel (Plavix)","Apixaban (Eliquis)","Famotidine (Pepcid)","Loratadine (Claritin)","Cetirizine (Zyrtec)","Diphenhydramine (Benadryl)","Hydroxyzine","Lorazepam (Ativan)","Alprazolam (Xanax)","Clonazepam (Klonopin)","Methylphenidate (Ritalin)","Spironolactone","Potassium","Folic Acid","Levothyroxine","Estradiol","Sildenafil (Viagra)","Tadalafil (Cialis)","Finasteride","Vitamin D","Vitamin B12","Vitamin C","Multivitamin","Fish Oil (Omega-3)","Magnesium","Melatonin","Calcium","Zinc","Iron","Probiotic","Biotin","Coenzyme Q10","Turmeric","Azithromycin (Z-Pak)","Doxycycline","Cephalexin (Keflex)","Cefdinir (Omnicef)","Ciprofloxacin (Cipro)","Levofloxacin (Levaquin)","Trimethoprim-Sulfamethoxazole (Bactrim)","Clindamycin (Cleocin)","Nitrofurantoin (Macrobid)","Metronidazole (Flagyl)","Amoxicillin-Clavulanate (Augmentin)","Valacyclovir (Valtrex)","Acyclovir (Zovirax)","Oseltamivir (Tamiflu)","Enalapril (Vasotec)","Ramipril (Altace)","Valsartan (Diovan)","Olmesartan (Benicar)","Propranolol (Inderal)","Diltiazem (Cardizem)","Verapamil (Calan)","Empagliflozin (Jardiance)","Dapagliflozin (Farxiga)","Sitagliptin (Januvia)","Glyburide (DiaBeta)","Pioglitazone (Actos)","Semaglutide (Ozempic / Wegovy)","Liraglutide (Victoza)","Dulaglutide (Trulicity)","Insulin Glargine (Lantus)","Insulin Aspart (Novolog)","Insulin Lispro (Humalog)","Fluticasone (Flonase)","Mometasone (Nasonex)","Budesonide (Pulmicort)","Pseudoephedrine (Sudafed)","Dextromethorphan (Robitussin)","Guaifenesin (Mucinex)","Benzonatate (Tessalon)","Zolpidem (Ambien)","Pregabalin (Lyrica)","Ondansetron (Zofran)","Methylprednisolone (Medrol)","Hydrocortisone","Triamcinolone (Kenalog)","Loperamide (Imodium)","Polyethylene Glycol (MiraLAX)","Senna (Senokot)","Docusate (Colace)","Methocarbamol (Robaxin)","Diclofenac (Voltaren)","Celecoxib (Celebrex)","Colchicine"];
+ var DAYS=[["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"],["Sun","Sunday"]];
+ var schedule={}; DAYS.forEach(function(d){schedule[d[0]]=[];});
+ var active="Mon";
+ function fullName(k){ for(var i=0;i<DAYS.length;i++){ if(DAYS[i][0]===k) return DAYS[i][1]; } return k; }
+ function splitName(s){ var m=s.match(/^(.*?)s*((.+))s*$/); return m?[m[1],m[2]]:[s,null]; }
+ function esc(s){ return s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;'); }
+
+ var daysEl=document.getElementById('days');
+ DAYS.forEach(function(d){ var b=document.createElement('button'); b.className='day'+(d[0]===active?' active':''); b.textContent=d[0]; b.onclick=function(){ active=d[0]; renderDays(); renderList(); renderChips(); }; daysEl.appendChild(b); });
+ function renderDays(){ var i=0; Array.prototype.forEach.call(daysEl.children,function(b){ b.className='day'+(DAYS[i][0]===active?' active':''); i++; }); }
+
+ function renderChips(){
+ var q=(document.getElementById('med').value||'').trim().toLowerCase();
+ var box=document.getElementById('chips'); box.innerHTML='';
+ var inDay=schedule[active]||[];
+ var matches=MEDS.filter(function(m){ return !q || m.toLowerCase().indexOf(q)!==-1; });
+ if(matches.length===0){ var e=document.createElement('div'); e.className='empty-chip'; e.textContent='No match — tap Add to use what you typed.'; box.appendChild(e); return; }
+ matches.forEach(function(m){
+ var p=splitName(m); var c=document.createElement('button');
+ c.className='chip'+(inDay.indexOf(m)!==-1?' in':'');
+ c.innerHTML=esc(p[0])+(p[1]?' <span class="b">'+esc(p[1])+'</span>':'');
+ c.onclick=function(){ addMed(m); };
+ box.appendChild(c);
+ });
+ }
+
+ function renderList(){
+ document.getElementById('dayLabel').textContent=fullName(active);
+ var items=schedule[active]||[];
+ document.getElementById('ct').textContent=items.length+(items.length===1?' med':' meds');
+ var ul=document.getElementById('list'); ul.innerHTML='';
+ if(items.length===0){ var li=document.createElement('li'); li.className='empty'; li.textContent='Nothing for '+fullName(active)+' yet.'; ul.appendChild(li); return; }
+ items.forEach(function(name,idx){
+ var li=document.createElement('li'); var p=splitName(name);
+ var nm=document.createElement('span'); nm.className='nm';
+ nm.innerHTML='<span class="dot"></span>'+esc(p[0])+(p[1]?'<span class="b2">'+esc(p[1])+'</span>':'');
+ var x=document.createElement('button'); x.className='rm'; x.textContent='✕'; x.setAttribute('aria-label','Remove '+name);
+ x.onclick=function(){ schedule[active].splice(idx,1); save(); renderList(); renderChips(); };
+ li.appendChild(nm); li.appendChild(x); ul.appendChild(li);
+ });
+ }
+
+ function addMed(name){ name=(name||'').trim(); if(!name) return; if(schedule[active].indexOf(name)===-1){ schedule[active].push(name); save(); renderList(); renderChips(); } }
+ function add(){ var inp=document.getElementById('med'); addMed(inp.value); inp.value=''; renderChips(); }
+ document.getElementById('addBtn').onclick=add;
+ var medInput=document.getElementById('med');
+ medInput.addEventListener('keydown',function(e){ if(e.key==='Enter')add(); });
+ medInput.addEventListener('input',renderChips);
+
+ var persistKnown=null, saveToken=0;
+ function setSaved(kind){
+ var s=document.getElementById('saved');
+ if(kind==='saving'){ s.className=''; s.textContent='Saving…'; }
+ else if(kind==='ok'){ s.className=''; s.textContent='Saved ✓'; setTimeout(function(){ if(s.textContent==='Saved ✓') s.textContent=''; },1500); }
+ else { s.className='warn'; s.textContent='⚠ Sign in to save your schedule.'; }
+ }
+ function save(){
+ if(!(window.liveloop&&window.liveloop.storage)){ setSaved('warn'); return; }
+ var stamp=String(Date.now())+'-'+Math.random();
+ window.liveloop.storage.set({schedule:schedule,_stamp:stamp});
+ if(persistKnown===false){ setSaved('warn'); return; }
+ var myToken=++saveToken; setSaved('saving');
+ setTimeout(function(){
+ if(myToken!==saveToken) return;
+ window.liveloop.storage.get().then(function(s){
+ if(myToken!==saveToken) return;
+ var ok=!!(s&&s._stamp===stamp); persistKnown=ok; setSaved(ok?'ok':'warn');
+ },function(){ setSaved('warn'); });
+ },1000);
+ }
+ function load(){
+ if(window.liveloop&&window.liveloop.storage){ window.liveloop.storage.get().then(function(s){ if(s&&s.schedule){ DAYS.forEach(function(d){ if(Array.isArray(s.schedule[d[0]])) schedule[d[0]]=s.schedule[d[0]]; }); } renderList(); renderChips(); },function(){ renderList(); renderChips(); }); }
+ else { renderList(); renderChips(); }
+ }
+ renderDays(); load(); renderChips();
+</script>

v1Current

@daily_dose · 5/21/2026, 8:45:53 PM

Initial version — all lines are new.

+<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap" rel="stylesheet">
+<style>
+ *{box-sizing:border-box}
+ html,body{height:100%;margin:0}
+ body{font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#2a2320;background:#f4eee3;position:relative;overflow:hidden;-webkit-text-size-adjust:100%}
+ .orb{position:absolute;border-radius:50%;filter:blur(60px);opacity:.5;pointer-events:none}
+ .orb.a{width:200px;height:200px;background:#e7d9ff;top:-60px;left:-50px}
+ .orb.b{width:170px;height:170px;background:#ffd6bd;bottom:40px;right:-55px}
+ #wrap{position:relative;z-index:1;max-width:360px;margin:0 auto;height:100%;display:flex;flex-direction:column;padding:1rem .9rem;overflow:auto}
+ .hd{text-align:center;margin-bottom:.4rem}
+ .hd h2{margin:0;font-family:'Instrument Serif',Georgia,serif;font-weight:400;font-size:2rem;line-height:1}
+ .hd h2 em{font-style:italic;color:#6b4efe}
+ .hd p{margin:.35rem 0 0;font-size:.66rem;color:#8a817a;line-height:1.35}
+ .days{display:flex;gap:4px;margin:.7rem 0 .55rem}
+ .day{flex:1;padding:.5rem 0;border:0;border-radius:.7rem;background:rgba(255,255,255,.72);color:#5c544c;font-weight:600;font-size:.72rem;cursor:pointer;transition:.15s}
+ .day.active{background:#2a2320;color:#fff}
+ .add{display:flex;gap:.4rem;margin-bottom:.55rem}
+ .add input{flex:1;border:1px solid #e6ddcd;border-radius:.7rem;padding:.6rem .7rem;font-size:16px;background:#fff;color:#2a2320}
+ .add input:focus{outline:none;border-color:#6b4efe}
+ .add button{border:0;border-radius:.7rem;background:#6b4efe;color:#fff;font-weight:700;padding:0 1.05rem;cursor:pointer;font-size:.85rem}
+ .seclabel{font-size:.6rem;letter-spacing:.13em;text-transform:uppercase;color:#a89f95;font-weight:700;margin:.2rem 0 .4rem}
+ .chips{display:flex;flex-wrap:wrap;gap:.35rem;max-height:118px;overflow:auto;padding:.1rem .1rem .3rem}
+ .chip{border:1px solid #e6ddcd;background:#fff;color:#3a332e;border-radius:999px;padding:.34rem .62rem;font-size:.72rem;cursor:pointer;white-space:nowrap;transition:.12s;line-height:1}
+ .chip:active{transform:scale(.96)}
+ .chip.in{background:#efeafd;border-color:#cfc2fb;color:#6b4efe}
+ .chip .b{color:#a89f95;font-size:.66rem;margin-left:.18rem}
+ .empty-chip{font-size:.74rem;color:#a89f95;padding:.35rem .2rem}
+ .listlabel{display:flex;align-items:baseline;justify-content:space-between;margin:.85rem 0 .45rem}
+ .listlabel .seclabel{margin:0}
+ .listlabel .ct{font-size:.66rem;color:#a89f95;font-weight:600}
+ ul{list-style:none;margin:0;padding:0;flex:1 0 auto}
+ li{display:flex;justify-content:space-between;align-items:center;background:#fff;border-radius:.8rem;padding:.6rem .75rem;margin-bottom:.4rem;box-shadow:0 1px 6px rgba(42,35,32,.06)}
+ li .nm{flex:1;font-size:.86rem;display:flex;align-items:center;min-width:0}
+ li .dot{width:8px;height:8px;border-radius:50%;background:#6b4efe;margin-right:.55rem;flex-shrink:0}
+ li .b2{color:#a89f95;font-size:.7rem;margin-left:.35rem}
+ li.empty{justify-content:center;color:#a89f95;font-size:.82rem;box-shadow:none;background:transparent}
+ li .rm{border:0;background:transparent;color:#d6492f;font-size:1.05rem;cursor:pointer;padding:0 .15rem}
+ #saved{text-align:center;font-size:.7rem;color:#16a34a;min-height:1.1em;margin-top:.5rem;font-weight:700}
+ #saved.warn{color:#b45309}
+</style>
+<div class="orb a"></div><div class="orb b"></div>
+<div id="wrap">
+ <div class="hd">
+ <h2>Weekly <em>Pills</em></h2>
+ <p>Personal organizer — not medical advice. Saved to your account.</p>
+ </div>
+ <div class="days" id="days"></div>
+ <div class="add">
+ <input id="med" placeholder="Search or type a medication…" autocomplete="off">
+ <button id="addBtn">Add</button>
+ </div>
+ <div class="seclabel">Tap to add</div>
+ <div class="chips" id="chips"></div>
+ <div class="listlabel"><div class="seclabel" id="dayLabel">Monday</div><div class="ct" id="ct"></div></div>
+ <ul id="list"></ul>
+ <div id="saved"></div>
+</div>
+<script>
+ var MEDS=["Acetaminophen (Tylenol)","Ibuprofen (Advil)","Aspirin","Naproxen (Aleve)","Lisinopril","Atorvastatin (Lipitor)","Levothyroxine (Synthroid)","Metformin","Amlodipine","Metoprolol","Omeprazole (Prilosec)","Losartan","Albuterol","Gabapentin","Hydrochlorothiazide","Sertraline (Zoloft)","Simvastatin","Montelukast (Singulair)","Escitalopram (Lexapro)","Rosuvastatin (Crestor)","Bupropion (Wellbutrin)","Furosemide (Lasix)","Pantoprazole","Prednisone","Fluoxetine (Prozac)","Citalopram (Celexa)","Tramadol","Trazodone","Amoxicillin","Cyclobenzaprine","Duloxetine (Cymbalta)","Meloxicam","Pravastatin","Carvedilol","Tamsulosin (Flomax)","Venlafaxine (Effexor)","Allopurinol","Atenolol","Glipizide","Insulin","Warfarin (Coumadin)","Clopidogrel (Plavix)","Apixaban (Eliquis)","Famotidine (Pepcid)","Loratadine (Claritin)","Cetirizine (Zyrtec)","Diphenhydramine (Benadryl)","Hydroxyzine","Lorazepam (Ativan)","Alprazolam (Xanax)","Clonazepam (Klonopin)","Methylphenidate (Ritalin)","Spironolactone","Potassium","Folic Acid","Levothyroxine","Estradiol","Sildenafil (Viagra)","Tadalafil (Cialis)","Finasteride","Vitamin D","Vitamin B12","Vitamin C","Multivitamin","Fish Oil (Omega-3)","Magnesium","Melatonin","Calcium","Zinc","Iron","Probiotic","Biotin","Coenzyme Q10","Turmeric","Azithromycin (Z-Pak)","Doxycycline","Cephalexin (Keflex)","Cefdinir (Omnicef)","Ciprofloxacin (Cipro)","Levofloxacin (Levaquin)","Trimethoprim-Sulfamethoxazole (Bactrim)","Clindamycin (Cleocin)","Nitrofurantoin (Macrobid)","Metronidazole (Flagyl)","Amoxicillin-Clavulanate (Augmentin)","Valacyclovir (Valtrex)","Acyclovir (Zovirax)","Oseltamivir (Tamiflu)","Enalapril (Vasotec)","Ramipril (Altace)","Valsartan (Diovan)","Olmesartan (Benicar)","Propranolol (Inderal)","Diltiazem (Cardizem)","Verapamil (Calan)","Empagliflozin (Jardiance)","Dapagliflozin (Farxiga)","Sitagliptin (Januvia)","Glyburide (DiaBeta)","Pioglitazone (Actos)","Semaglutide (Ozempic / Wegovy)","Liraglutide (Victoza)","Dulaglutide (Trulicity)","Insulin Glargine (Lantus)","Insulin Aspart (Novolog)","Insulin Lispro (Humalog)","Fluticasone (Flonase)","Mometasone (Nasonex)","Budesonide (Pulmicort)","Pseudoephedrine (Sudafed)","Dextromethorphan (Robitussin)","Guaifenesin (Mucinex)","Benzonatate (Tessalon)","Zolpidem (Ambien)","Pregabalin (Lyrica)","Ondansetron (Zofran)","Methylprednisolone (Medrol)","Hydrocortisone","Triamcinolone (Kenalog)","Loperamide (Imodium)","Polyethylene Glycol (MiraLAX)","Senna (Senokot)","Docusate (Colace)","Methocarbamol (Robaxin)","Diclofenac (Voltaren)","Celecoxib (Celebrex)","Colchicine"];
+ var DAYS=[["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"],["Sun","Sunday"]];
+ var schedule={}; DAYS.forEach(function(d){schedule[d[0]]=[];});
+ var active="Mon";
+ function fullName(k){ for(var i=0;i<DAYS.length;i++){ if(DAYS[i][0]===k) return DAYS[i][1]; } return k; }
+ function splitName(s){ var m=s.match(/^(.*?)s*((.+))s*$/); return m?[m[1],m[2]]:[s,null]; }
+ function esc(s){ return s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;'); }
+
+ var daysEl=document.getElementById('days');
+ DAYS.forEach(function(d){ var b=document.createElement('button'); b.className='day'+(d[0]===active?' active':''); b.textContent=d[0]; b.onclick=function(){ active=d[0]; renderDays(); renderList(); renderChips(); }; daysEl.appendChild(b); });
+ function renderDays(){ var i=0; Array.prototype.forEach.call(daysEl.children,function(b){ b.className='day'+(DAYS[i][0]===active?' active':''); i++; }); }
+
+ function renderChips(){
+ var q=(document.getElementById('med').value||'').trim().toLowerCase();
+ var box=document.getElementById('chips'); box.innerHTML='';
+ var inDay=schedule[active]||[];
+ var matches=MEDS.filter(function(m){ return !q || m.toLowerCase().indexOf(q)!==-1; });
+ if(matches.length===0){ var e=document.createElement('div'); e.className='empty-chip'; e.textContent='No match — tap Add to use what you typed.'; box.appendChild(e); return; }
+ matches.forEach(function(m){
+ var p=splitName(m); var c=document.createElement('button');
+ c.className='chip'+(inDay.indexOf(m)!==-1?' in':'');
+ c.innerHTML=esc(p[0])+(p[1]?' <span class="b">'+esc(p[1])+'</span>':'');
+ c.onclick=function(){ addMed(m); };
+ box.appendChild(c);
+ });
+ }
+
+ function renderList(){
+ document.getElementById('dayLabel').textContent=fullName(active);
+ var items=schedule[active]||[];
+ document.getElementById('ct').textContent=items.length+(items.length===1?' med':' meds');
+ var ul=document.getElementById('list'); ul.innerHTML='';
+ if(items.length===0){ var li=document.createElement('li'); li.className='empty'; li.textContent='Nothing for '+fullName(active)+' yet.'; ul.appendChild(li); return; }
+ items.forEach(function(name,idx){
+ var li=document.createElement('li'); var p=splitName(name);
+ var nm=document.createElement('span'); nm.className='nm';
+ nm.innerHTML='<span class="dot"></span>'+esc(p[0])+(p[1]?'<span class="b2">'+esc(p[1])+'</span>':'');
+ var x=document.createElement('button'); x.className='rm'; x.textContent='✕'; x.setAttribute('aria-label','Remove '+name);
+ x.onclick=function(){ schedule[active].splice(idx,1); save(); renderList(); renderChips(); };
+ li.appendChild(nm); li.appendChild(x); ul.appendChild(li);
+ });
+ }
+
+ function addMed(name){ name=(name||'').trim(); if(!name) return; if(schedule[active].indexOf(name)===-1){ schedule[active].push(name); save(); renderList(); renderChips(); } }
+ function add(){ var inp=document.getElementById('med'); addMed(inp.value); inp.value=''; renderChips(); }
+ document.getElementById('addBtn').onclick=add;
+ var medInput=document.getElementById('med');
+ medInput.addEventListener('keydown',function(e){ if(e.key==='Enter')add(); });
+ medInput.addEventListener('input',renderChips);
+
+ var persistKnown=null, saveToken=0;
+ function setSaved(kind){
+ var s=document.getElementById('saved');
+ if(kind==='saving'){ s.className=''; s.textContent='Saving…'; }
+ else if(kind==='ok'){ s.className=''; s.textContent='Saved ✓'; setTimeout(function(){ if(s.textContent==='Saved ✓') s.textContent=''; },1500); }
+ else { s.className='warn'; s.textContent='⚠ Sign in to save your schedule.'; }
+ }
+ function save(){
+ if(!(window.liveloop&&window.liveloop.storage)){ setSaved('warn'); return; }
+ var stamp=String(Date.now())+'-'+Math.random();
+ window.liveloop.storage.set({schedule:schedule,_stamp:stamp});
+ if(persistKnown===false){ setSaved('warn'); return; }
+ var myToken=++saveToken; setSaved('saving');
+ setTimeout(function(){
+ if(myToken!==saveToken) return;
+ window.liveloop.storage.get().then(function(s){
+ if(myToken!==saveToken) return;
+ var ok=!!(s&&s._stamp===stamp); persistKnown=ok; setSaved(ok?'ok':'warn');
+ },function(){ setSaved('warn'); });
+ },1000);
+ }
+ function load(){
+ if(window.liveloop&&window.liveloop.storage){ window.liveloop.storage.get().then(function(s){ if(s&&s.schedule){ DAYS.forEach(function(d){ if(Array.isArray(s.schedule[d[0]])) schedule[d[0]]=s.schedule[d[0]]; }); } renderList(); renderChips(); },function(){ renderList(); renderChips(); }); }
+ else { renderList(); renderChips(); }
+ }
+ renderDays(); load(); renderChips();
+</script>
← Version history