untitled

Pasted Oct 6, 2026, 10:01 PM1 file197 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/ayonahq
untitled
from pathlib import Path
import re

src = Path("/mnt/data/ayona_life_hq_focus.html")
out = Path("/mnt/data/ayona_life_hq_updated.html")

if not src.exists():
    raise FileNotFoundError("The existing Focus Edition file could not be found.")

html = src.read_text(encoding="utf-8")

# 1) Quick Launch: compact 2-column layout, remove Planner, add ChatGPT/Links/Classes.
old_launch = """<div class="card span4"><h2>๐Ÿš€ Quick launch</h2><div class="launch">
<a href="https://open.spotify.com/" target="_blank">๐ŸŽง<br>Spotify</a>
<a href="https://ebnet.instructure.com/" target="_blank">๐ŸŽ“<br>Canvas</a>
<a href="#" onclick="go('planner');return false">๐Ÿ“<br>Planner</a>
<a href="#" onclick="go('journal');return false">๐Ÿ“–<br>Journal</a>
</div></div>"""
new_launch = """<div class="card span4"><h2>๐Ÿš€ Quick launch</h2><div class="launch">
<a href="https://chatgpt.com/" target="_blank">๐Ÿค– ChatGPT</a>
<a href="https://open.spotify.com/" target="_blank">๐ŸŽง Spotify</a>
<a href="https://ebnet.instructure.com/" target="_blank">๐ŸŽ“ Canvas</a>
<a href="#" onclick="go('journal');return false">๐Ÿ“– Journal</a>
<a href="#" onclick="go('study');return false">๐Ÿ“š Study Hub</a>
<a href="#" onclick="go('links');return false">๐Ÿ”— Links</a>
<a href="#" onclick="go('classes');return false">๐Ÿซ Classes</a>
<a href="#" class="full" onclick="go('focus');return false">๐ŸŽฏ Focus Timer</a>
</div></div>"""
if old_launch in html:
    html = html.replace(old_launch, new_launch)

# 2) Remove Planner from navigation and page.
html = re.sub(r"<section id=\"planner\".*?</section>", "", html, flags=re.S)
html = html.replace("['planner','๐Ÿ“ Planner'],", "")

# 3) Add/replace styles for the new card layouts.
css = """
.launch{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.launch a{text-decoration:none;color:var(--ink);background:#f0e5d4;padding:11px 7px;border-radius:15px;text-align:center;font-weight:800;border:1px solid #e2d1bc;min-width:0;line-height:1.2;font-size:14px}
.launch a:hover{transform:translateY(-2px);background:#ead8c0}
.launch a.full{grid-column:1/-1}
.link-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.link-section{background:#fffdf8;border:1px solid #eadfce;border-radius:18px;padding:15px}
.link-section h3{font:800 19px Georgia,serif;margin:0 0 9px;color:var(--wine)}
.link-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.link-btn{display:flex;align-items:center;justify-content:space-between;gap:8px;text-decoration:none;color:var(--ink);background:#f3e9db;border:1px solid #e2d1bc;border-radius:13px;padding:10px 11px;font-weight:800;min-width:0}
.link-btn span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.form-grid .full{grid-column:1/-1}
.class-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.class-card{background:#fffdf8;border:1px solid #eadfce;border-radius:15px;padding:13px}
.class-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}
.add-section-card{border:2px dashed #d9c5ac;background:#fffaf0}
"""
if ".link-grid{" not in html:
    marker = ".launch a:hover{transform:translateY(-2px);background:#ead8c0}"
    if marker in html:
        html = html.replace(marker, css)
    else:
        html = html.replace("</style>", css + "</style>", 1)

# 4) Responsive rules.
html = re.sub(
    r"@media\(max-width:800px\)\{.*?\}",
    """@media(max-width:800px){.span4,.span6,.span8{grid-column:span 12}.launch{grid-template-columns:repeat(2,minmax(0,1fr))}.link-grid,.class-grid{grid-template-columns:1fr}.form-grid{grid-template-columns:1fr}.form-grid .full{grid-column:auto}}""",
    html,
    count=1
)

# 5) Study Hub: proper rectangular form + separate link cards.
study_pattern = r'<section id="study" class="page">.*?</section>'
study_new = """<section id="study" class="page">
<div class="grid">
  <div class="card span5">
    <h2>๐Ÿ“š Add a study link</h2>
    <div class="form-grid">
      <input id="sn" placeholder="Link name">
      <input id="su" placeholder="https://..." class="full">
    </div>
    <button class="btn" onclick="addStudyLink()">๏ผ‹ Save study link</button>
    <p class="small">Each study resource gets its own clickable button.</p>
  </div>
  <div class="card span7">
    <h2>๐Ÿ”– My study links</h2>
    <div id="studyLinks"></div>
  </div>
</div>
</section>"""
html = re.sub(study_pattern, study_new, html, count=1, flags=re.S)

# 6) Links page with sections and "add another big section".
if '<section id="links" class="page">' not in html:
    links_section = """<section id="links" class="page">
<div class="grid">
  <div class="card span5">
    <h2>๐Ÿ”— Add a link</h2>
    <div class="form-grid">
      <input id="ln" placeholder="Link name">
      <input id="lu" placeholder="https://..." class="full">
      <select id="lsection" class="full"></select>
    </div>
    <button class="btn" onclick="addLink()">๏ผ‹ Add to section</button>
    <p class="small">Choose a section and your link becomes a button inside it.</p>
  </div>
  <div class="card span7">
    <h2>๐Ÿ—‚๏ธ My link sections</h2>
    <div id="linkSections" class="link-grid"></div>
  </div>
  <div class="card span12 add-section-card">
    <h2>โž• Add another big section</h2>
    <div class="form-grid">
      <input id="sectionName" placeholder="Section name">
      <input id="sectionEmoji" placeholder="Emoji (optional)">
    </div>
    <button class="btn gold" onclick="addLinkSection()">๏ผ‹ Create section</button>
    <p class="small">Make sections for School, Coding, Fun, Inspiration, Shopping, etc.</p>
  </div>
</div>
</section>

"""
    html = html.replace('<section id="focus" class="page">', links_section + '<section id="focus" class="page">')

# 7) Classes page with class/Canvas link field.
classes_pattern = r'<section id="classes" class="page">.*?</section>'
classes_new = """<section id="classes" class="page">
<div class="grid">
  <div class="card span5">
    <h2>๐ŸŽ“ Add a class</h2>
    <div class="form-grid">
      <input id="cn" placeholder="Math 7">
      <input id="ct" placeholder="Teacher">
      <input id="cu" placeholder="Class / Canvas link" class="full">
    </div>
    <button class="btn" onclick="addClass()">๏ผ‹ Save class</button>
    <p class="small">Add Canvas, Google Classroom, teacher pages, or class resources.</p>
  </div>
  <div class="card span7">
    <h2>๐Ÿซ My classes</h2>
    <div id="classes" class="class-grid"></div>
  </div>
</div>
</section>"""
html = re.sub(classes_pattern, classes_new, html, count=1, flags=re.S)

# 8) Data structure.
html = html.replace(
"""let D=JSON.parse(localStorage.getItem(KEY)||'{"events":[],"tasks":[],"links":[],"classes":[],"journals":[],"top3":"","check":{}}');""",
"""let D=JSON.parse(localStorage.getItem(KEY)||'{"events":[],"tasks":[],"links":[],"linkSections":[],"classes":[],"journals":[],"top3":"","check":{}}');
D.links=D.links||[]; D.linkSections=D.linkSections||[]; D.classes=D.classes||[];"""
)

# 9) Navigation.
html = html.replace(
"""const today=new Date(), navs=[['home','๐Ÿ  Home'],['calendar','๐Ÿ“… Calendar'],['planner','๐Ÿ“ Planner'],['journal','๐Ÿ“– Journal'],['study','๐Ÿ“š Study Hub'],['classes','๐ŸŽ“ Classes'],['focus','๐ŸŽฏ Focus']];""",
"""const today=new Date(), navs=[['home','๐Ÿ  Home'],['calendar','๐Ÿ“… Calendar'],['journal','๐Ÿ“– Journal'],['study','๐Ÿ“š Study Hub'],['links','๐Ÿ”— Links'],['classes','๐ŸŽ“ Classes'],['focus','๐ŸŽฏ Focus']];"""
)

# 10) Replace link functions if they exist in the original file.
start = html.find("function addLink(){")
end = html.find("\nfunction addClass()", start)
if start != -1 and end != -1:
    funcs = """function normalizeUrl(u){u=(u||'').trim();return !u?'':(/^https?:\\/\\//i.test(u)?u:'https://'+u)}
function addStudyLink(){let n=document.getElementById('sn').value.trim(),u=normalizeUrl(document.getElementById('su').value);if(!n||!u)return;D.links.push({n,u});save();document.getElementById('sn').value='';document.getElementById('su').value='';renderStudyLinks()}
function renderStudyLinks(){let el=document.getElementById('studyLinks');if(!el)return;el.innerHTML=D.links.length?'<div class="link-buttons">'+D.links.map((x,i)=>`<a class="link-btn" href="${esc(x.u)}" target="_blank" rel="noopener"><span>๐Ÿ“š ${esc(x.n)}</span><span>โ†—</span></a><button class="x" onclick="D.links.splice(${i},1);save();renderStudyLinks()">ร—</button>`).join('')+'</div>':'<p class="small">No study links yet. Add one above โœจ</p>';if(document.getElementById('studyPreview'))document.getElementById('studyPreview').innerHTML=D.links.length?D.links.slice(0,4).map(x=>`<div class="item"><a href="${esc(x.u)}" target="_blank" style="color:var(--wine);font-weight:800">${esc(x.n)} โ†—</a></div>`).join(''):'<p class="small">No saved study links yet.</p>'}
function ensureLinkSections(){if(!D.linkSections.length)D.linkSections=[{id:Date.now(),name:'School',emoji:'๐ŸŽ“',links:[]},{id:Date.now()+1,name:'Fun',emoji:'โœจ',links:[]}]}
function populateSectionSelect(){let s=document.getElementById('lsection');if(!s)return;ensureLinkSections();s.innerHTML=D.linkSections.map(x=>`<option value="${x.id}">${esc(x.emoji||'๐Ÿ”—')} ${esc(x.name)}</option>`).join('')}
function addLink(){let n=document.getElementById('ln').value.trim(),u=normalizeUrl(document.getElementById('lu').value),sid=document.getElementById('lsection').value;if(!n||!u||!sid)return;let sec=D.linkSections.find(x=>String(x.id)===String(sid));if(!sec)return;sec.links.push({n,u});save();document.getElementById('ln').value='';document.getElementById('lu').value='';renderLinkSections()}
function addLinkSection(){let n=document.getElementById('sectionName').value.trim(),e=document.getElementById('sectionEmoji').value.trim()||'๐Ÿ”—';if(!n)return;D.linkSections.push({id:Date.now()+Math.random(),name:n,emoji:e,links:[]});save();document.getElementById('sectionName').value='';document.getElementById('sectionEmoji').value='';populateSectionSelect();renderLinkSections()}
function renderLinkSections(){ensureLinkSections();populateSectionSelect();let el=document.getElementById('linkSections');if(!el)return;el.innerHTML=D.linkSections.map((s,si)=>`<div class="link-section"><h3>${esc(s.emoji||'๐Ÿ”—')} ${esc(s.name)}</h3>${s.links.length?'<div class="link-buttons">'+s.links.map((x,li)=>`<a class="link-btn" href="${esc(x.u)}" target="_blank" rel="noopener"><span>${esc(x.n)}</span><span>โ†—</span></a><button class="x" onclick="D.linkSections[${si}].links.splice(${li},1);save();renderLinkSections()">ร—</button>`).join('')+'</div>':'<p class="small">No links here yet.</p>'}<div class="section-actions"><button class="btn gold" onclick="document.getElementById('lsection').value='${s.id}';document.getElementById('ln').focus()">๏ผ‹ Add here</button>${D.linkSections.length>1?`<button class="x" onclick="if(confirm('Delete this section and its links?')){D.linkSections.splice(${si},1);save();renderLinkSections()}">Delete section</button>`:''}</div></div>`).join('')}
"""
    html = html[:start] + funcs + html[end:]

# 11) Replace classes function with link support.
cstart = html.find("function addClass(){")
if cstart != -1:
    # Find next function after classes.
    cend = html.find("\nfunction ", cstart + 10)
    if cend != -1:
        cfunc = """function addClass(){let n=document.getElementById('cn').value.trim(),t=document.getElementById('ct').value.trim(),u=normalizeUrl(document.getElementById('cu').value);if(!n||!u)return;D.classes.push({n,t,u});save();document.getElementById('cn').value='';document.getElementById('ct').value='';document.getElementById('cu').value='';classes()}
function classes(){let el=document.getElementById('classes');if(!el)return;el.innerHTML=D.classes.length?D.classes.map((x,i)=>`<div class="class-card"><b>๐ŸŽ“ ${esc(x.n)}</b>${x.t?`<div class="small" style="margin-top:4px">${esc(x.t)}</div>`:''}<div class="class-actions"><a class="btn" href="${esc(x.u)}" target="_blank" rel="noopener" style="text-decoration:none">Open class โ†—</a><button class="x" onclick="D.classes.splice(${i},1);save();classes()">Delete</button></div></div>`).join(''):'<p class="small">Add your Math, Science, ILA, Spanish, etc. class links here.</p>'}
"""
        html = html[:cstart] + cfunc + html[cend:]

# 12) Journal controls: convert common option spans into actual buttons only if needed.
# The original Focus Edition already had functional choices; keep those handlers intact.
# This avoids breaking its existing journal state/localStorage logic.

# 13) Init.
html = html.replace(
"renderCheck();tasks();cal();events();links();classes();entries();setTimerDisplay();go('home')",
"renderCheck();tasks();cal();events();renderStudyLinks();ensureLinkSections();populateSectionSelect();renderLinkSections();classes();entries();setTimerDisplay();go('home')"
)

out.write_text(html, encoding="utf-8")
print(f"Created updated HQ: {out}")

12,836 chars ยท codepastes.com