diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ecfb0c..eae5f14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.1.17 (2026-11-16) + +### Changes +- HK 12 taken for more than one sport now fills one HK slot each time. Before, only the first HK 12 counted. +- BS CS free electives no longer wait for senior standing. +- Every Wrapped card credits its design to Reann Vargas and Danica Manadong at the bottom of the image. +- The sem card sits in Reann's tin with a spot for your photo, its GWA, your best course and a ribbon for University or College Scholar. Every other card can leave a polaroid spot for a photo you add in Instagram or Facebook. + ## 2.1.16 (2026-11-16) ### Changes diff --git a/extension/requirements.test.js b/extension/requirements.test.js index b80942a..8be3749 100644 --- a/extension/requirements.test.js +++ b/extension/requirements.test.js @@ -169,10 +169,12 @@ console.log('requirements.test.js: surplus electives passed'); const once = fillRequirementSlots(sp, [row('CMSC 190', 1), row('CMSC 198', 3)]); assert.ok(once.has('CMSC 190') && !once.has('CMSC 190 (2)') && once.has('CMSC 198') && !once.has('FE 1')); assert.ok(fillRequirementSlots(sp, [row('CMSC 190', 1), row('CMSC 190', 2)]).has('CMSC 190 (2)')); + const hk = fillRequirementSlots(sp, [row('HK 11', 2), row('HK 12', 2), row('HK 12', 2), row('HK 12', 2)]); + assert.ok(['HK 1', 'HK 2', 'HK 3', 'HK 4'].every(c => hk.has(c)), 'each HK 12 sport fills its own slot'); const fresh = scheduleEarliest({ courses: sp, passed: new Set(), useMidyear: false, totalUnits: 130 }); assert.strictEqual(fresh.plan.find(t => t.courses.includes('CMSC 198')).sem, 'midyear'); const firstFE = Math.min(...sp.filter(c => /^FE/.test(c.code)).map(c => fresh.assignedTerm[c.code])); - assert.ok(firstFE >= 9, `free electives start in senior year, got term ${firstFE}`); + assert.ok(firstFE < 9, `free electives need no standing, got term ${firstFE}`); assert.ok(fresh.assignedTerm['CMSC 190 (2)'] > fresh.assignedTerm['CMSC 190']); const thesis = plannerCourseList(UPLB_PROGRAMS.BSCS, 'thesis', UPLB_CATALOG); assert.strictEqual(thesis.filter(c => !isNonGwaCourseCode(c.code)).reduce((s, c) => s + c.units, 0), 130); diff --git a/extension/src/curriculum.js b/extension/src/curriculum.js index b386258..a11d551 100644 --- a/extension/src/curriculum.js +++ b/extension/src/curriculum.js @@ -150,7 +150,6 @@ function freeElectiveCourses(program, track) { year: slot.year, sem: slot.sem, prereqs: [], - standing: program.freeElectiveStanding, genericRequirement: 'elective' }); } @@ -252,7 +251,6 @@ const UPLB_PROGRAMS = { } }, "defaultTrack": "sp", - "freeElectiveStanding": "senior", "majorCourses": [ { "code": "MATH 27", diff --git a/extension/src/frames/photo.jpg b/extension/src/frames/photo.jpg new file mode 100644 index 0000000..0b52891 Binary files /dev/null and b/extension/src/frames/photo.jpg differ diff --git a/extension/src/frames/tin-grass.jpg b/extension/src/frames/tin-grass.jpg deleted file mode 100644 index b5cf1d8..0000000 Binary files a/extension/src/frames/tin-grass.jpg and /dev/null differ diff --git a/extension/src/popup.html b/extension/src/popup.html index 848008b..d56ff42 100644 --- a/extension/src/popup.html +++ b/extension/src/popup.html @@ -154,12 +154,13 @@

Course planner

- - + + - -

Add your photo over the picture in Instagram or Facebook.

+ + +

Add your photo over the picture in Instagram or Facebook.

diff --git a/extension/src/popup.js b/extension/src/popup.js index 78beee5..3f3ed92 100644 --- a/extension/src/popup.js +++ b/extension/src/popup.js @@ -853,7 +853,7 @@ function initializeWrapped() { $('wrappedNext').addEventListener('click', () => navigateWrapped(1)); $('wrappedExport').addEventListener('click', exportWrappedToPNG); $('wrappedName').addEventListener('input', redrawTin); - ['wrappedShow', 'wrappedTop'].forEach(id => $(id).addEventListener('change', redrawTin)); + ['wrappedShow', 'wrappedTop', 'wrappedPhoto'].forEach(id => $(id).addEventListener('change', redrawTin)); $('wrappedLine').addEventListener('input', redrawTin); $('wrappedSem').addEventListener('change', () => { wrappedPanels = generateWrappedPanels(generateWrappedData(wrappedCourses), wrappedCourses, Number($('wrappedSem').value)).filter(Boolean); @@ -957,7 +957,7 @@ function generateThisSemPanel(data, courses, pick = data.semList.length - 1) { : `${taken.reduce((u, c) => u + (c.units || 0), 0)} units done this sem`; return { emoji: '🍓', title, value: g.toFixed(4), subtitle: sem.name, message, extra, frame: 'sem', - highlights: top ? [{ label: '🏆 Top grade', name: top.code, detail: top.grade.toFixed(2) }] : [], + highlights: top ? [{ label: '🏆 Best course', name: top.code, detail: top.grade.toFixed(2) }] : [], }; } @@ -1055,7 +1055,7 @@ function wrappedId() { ? new Date(fetchedAt).toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }) : ''; return { name: $('wrappedName').value.trim(), year, course: $('programSelect').value, show: $('wrappedShow').value || 'none', - top: $('wrappedTop').checked, line: $('wrappedLine').value.trim(), amis, + top: $('wrappedTop').checked, line: $('wrappedLine').value.trim(), amis, photo: $('wrappedPhoto').checked, }; } @@ -1071,8 +1071,9 @@ function shownGwa(value = '', show = 'none') { const tinImages = {}; const bareLabel = label => label.replace(/^\P{L}+/u, ''); -const FRAMES = { sem: 'tin-grass', id: 'tin-id', tin: 'tin', note: 'tin-note', tray: 'tray', open: 'tin-red' }; +const FRAMES = { sem: 'tin-note', id: 'tin-id', tin: 'tin', note: 'tin', tray: 'tray', open: 'tin-red' }; const INK = '#1c1917', SOFT = '#4a3f3c', RED = '#7b2a22', URL = 'gradesim.uplb.tools'; +const CREDIT = 'Design by Reann Vargas and Danica Manadong'; // Reann Vargas's pages. Each tin, tray and note is tilted, so text is drawn turned with it. async function drawTinFrame(canvas, p) { @@ -1098,14 +1099,47 @@ async function drawTinFrame(canvas, p) { ctx.fillStyle = color; ctx.fillText(t, x, y, max); }; - const onGrass = (t, weight, size, x, y) => { + const shadow = blur => { + ctx.shadowColor = 'rgba(0,0,0,0.35)'; + ctx.shadowBlur = blur; + ctx.shadowOffsetY = blur / 3; + }; + // A cream label on the picnic cloth or grass. + const tag = (t, size, x, y, turn) => at(x, y, turn, () => { + ctx.font = `800 ${size}px ${font}`; + const w = ctx.measureText(t).width + size * 1.4; ctx.save(); - ctx.shadowColor = 'rgba(0,0,0,0.75)'; - ctx.shadowBlur = 18; - text(t, weight, size, '#ffffff', y, 1000, x); + shadow(16); + ctx.fillStyle = '#fbf5ea'; + ctx.beginPath(); + ctx.roundRect(-w / 2, -size * 0.95, w, size * 1.5, 10); + ctx.fill(); ctx.restore(); - }; + text(t, 800, size, INK, size * 0.18); + }); + const star = (x, y, r, turn) => at(x, y, turn, () => { + ctx.fillStyle = '#f2c230'; + ctx.beginPath(); + for (let i = 0; i < 10; i++) { + const a = (Math.PI / 5) * i - Math.PI / 2; + const d = i % 2 ? r * 0.45 : r; + ctx.lineTo(Math.cos(a) * d, Math.sin(a) * d); + } + ctx.fill(); + }); const id = wrappedId(); + const photo = tinImages['frames/photo.jpg'] ||= Object.assign(new Image(), { src: 'frames/photo.jpg' }); + if (id.photo && p.frame !== 'id') await photo.decode(); + // A polaroid with Reann's picture placeholder, for a photo added in Instagram. + const polaroid = (x, y, w, turn) => at(x, y, turn, () => { + const ph = w * 1.07; + ctx.save(); + shadow(24); + ctx.fillStyle = '#ffffff'; + ctx.fillRect(-w / 2 - 16, -ph / 2 - 16, w + 32, ph + 70); + ctx.restore(); + ctx.drawImage(photo, -w / 2, -ph / 2, w, ph); + }); const g = shownGwa(p.value, id.show); if (id.amis) { @@ -1134,19 +1168,57 @@ async function drawTinFrame(canvas, p) { ctx.textAlign = 'center'; } + ctx.font = `600 28px ${font}`; + const cw = ctx.measureText(CREDIT).width + 48; + ctx.fillStyle = 'rgba(28,25,23,0.82)'; + ctx.beginPath(); + ctx.roundRect(540 - cw / 2, 1526, cw, 50, 25); + ctx.fill(); + ctx.fillStyle = '#ffffff'; + ctx.fillText(CREDIT, 540, 1561); + + if (id.photo && (p.frame === 'tin' || p.frame === 'note')) polaroid(722, 455, 220, 0.12); + if (id.photo && (p.frame === 'tray' || p.frame === 'open')) polaroid(842, 420, 230, 0.1); + if (p.frame === 'sem') { const top = id.top ? p.highlights[0] : null; - ctx.translate(540, 1040); - ctx.rotate(-0.08); - ctx.translate(-540, -1040); - onGrass(`My ${p.subtitle}`, 700, 50, 540, 760); - if (g) { - onGrass(g, 800, 220, 540, 990); - onGrass(p.title, 800, 76, 540, 1090); - } else onGrass(p.title, 800, 112, 540, 960); - onGrass(id.line || p.extra, 700, 50, 540, g ? 1180 : 1070); - if (top) onGrass(`Top grade ${top.name}, ${top.detail}`, 600, 44, 540, g ? 1260 : 1150); - onGrass(URL, 600, 38, 540, g ? 1350 : 1250); + const [term, ay] = p.subtitle.split(' AY '); + if (id.photo) at(345, 744, -0.163, () => ctx.drawImage(photo, -175, -185, 350, 375)); + at(752, 730, -0.16, () => { + text('My', 600, 36, SOFT, -66, 280); + text(term, 800, 56, INK, 0, 290); + if (ay) text(`AY ${ay}`, 700, 38, RED, 56, 290); + }); + at(595, 1228, -0.14, () => { + const lines = []; + if (id.line || p.extra) lines.push([id.line || p.extra, 700, 44, INK]); + if (top) lines.push([`Best course ${top.name}, ${top.detail}`, 600, 38, SOFT]); + let y = g ? -150 : -95; + if (/Scholar$/.test(p.title)) { + ctx.font = `800 58px ${font}`; + const w = ctx.measureText(p.title).width + 120; + ctx.fillStyle = RED; + ctx.beginPath(); + ctx.moveTo(-w / 2 - 40, y - 52); + ctx.lineTo(w / 2 + 40, y - 52); + ctx.lineTo(w / 2 + 10, y - 8); + ctx.lineTo(w / 2 + 40, y + 36); + ctx.lineTo(-w / 2 - 40, y + 36); + ctx.lineTo(-w / 2 - 10, y - 8); + ctx.closePath(); + ctx.fill(); + text(p.title, 800, 58, '#fff4e0', y + 12, w - 60); + star(-w / 2 + 6, y - 56, 40, -0.3); + star(w / 2 - 6, y - 52, 32, 0.25); + } else text(p.title, 800, g ? 72 : 96, INK, y + 10, 680); + if (g) text(g, 800, 170, RED, (y += 175)); + y += g ? 70 : 85; + lines.forEach(([t, weight, size, color]) => { + text(t, weight, size, color, y, 680); + y += size + 22; + }); + text(URL, 600, 32, SOFT, Math.max(y + 8, 200)); + }); return canvas; } @@ -1170,7 +1242,7 @@ async function drawTinFrame(canvas, p) { if (p.frame === 'tin') { at(500, 690, -0.17, () => { - text(`${p.value} ${p.value === '1' ? 'sem' : 'sems'} done`, 800, 68, INK, -110, 380, -120); + text(`${p.value} ${p.value === '1' ? 'sem' : 'sems'} done`, 800, 68, INK, -110, id.photo ? 300 : 380, id.photo ? -170 : -120); const g = p.sems; if (g.length > 1) { const x = i => -280 + (560 * i) / (g.length - 1); @@ -1188,10 +1260,10 @@ async function drawTinFrame(canvas, p) { ctx.fill(); }); } - text(URL, 600, 36, SOFT, 175); }); + at(596, 1225, -0.17, () => text(URL, 600, 32, SOFT, 222)); p.highlights.forEach((x, i) => at(596, 1225, -0.17, () => { - const y = p.highlights.length > 1 ? i * 205 - 150 : -30; + const y = p.highlights.length > 1 ? i * 195 - 180 : -40; text(bareLabel(x.label), 600, 38, SOFT, y); text(x.name, 800, 62, INK, y + 72, 700); text(x.detail, 700, 40, RED, y + 130, 700); @@ -1210,8 +1282,8 @@ async function drawTinFrame(canvas, p) { ctx.fill(); text(b.text, 800, 34, '#ffffff', cy + 12, 100, cx); })); - at(770, 700, -0.17, () => { - text(p.value, 800, 160, RED, 40, 300); + at(770, id.photo ? 770 : 700, -0.17, () => { + text(p.value, 800, id.photo ? 130 : 160, RED, 40, 300); text(p.subtitle, 700, 38, INK, 100, 300); }); at(590, 1215, -0.18, () => { @@ -1225,7 +1297,7 @@ async function drawTinFrame(canvas, p) { if (p.frame === 'tray') { const [best, low, kept] = p.highlights; - onGrass('My highlights', 800, 76, 470, 540); + tag('My highlights', 64, 430, 520, -0.1); at(375, 1070, -0.1, () => { text(bareLabel(best.label), 600, 36, SOFT, -170, 330); text(best.name, 800, 80, INK, -80, 330); @@ -1239,7 +1311,7 @@ async function drawTinFrame(canvas, p) { }); corner(838, 805, low, ['', '', '']); corner(860, 1185, kept, ['So far', p.extra, 'and counting']); - onGrass(URL, 700, 40, 540, 1555); + tag(URL, 36, 540, 1478, -0.05); return canvas; } @@ -1311,7 +1383,10 @@ function updateWrappedDisplay() { $('wrappedShow').replaceChildren(...GWA_SHOWS.map(k => h('option', { value: k }, k === 'none' ? 'Tier only' : shownGwa(p.value, k)))); $('wrappedShow').value = show; $('wrappedPanel').replaceChildren(...flat(wrappedPanel(p))); - $('wrappedId').hidden = p.frame !== 'id' && p.frame !== 'sem'; + $('wrappedId').hidden = !p.frame; + $('wrappedId').querySelectorAll('.wrapped-gwa').forEach(el => (el.hidden = p.frame !== 'id' && p.frame !== 'sem')); + $('wrappedId').querySelectorAll('.wrapped-photo').forEach(el => (el.hidden = p.frame === 'id')); + $('wrappedPhotoHint').hidden = p.frame !== 'id' && !$('wrappedPhoto').checked; $('wrappedId').querySelectorAll('.wrapped-name').forEach(el => (el.hidden = p.frame !== 'id')); $('wrappedId').querySelectorAll('.wrapped-sem').forEach(el => (el.hidden = p.frame !== 'sem')); $('wrappedAmisHint').hidden = !p.frame || !!wrappedId().amis; diff --git a/extension/src/requirements.js b/extension/src/requirements.js index ceb3e48..b28c102 100644 --- a/extension/src/requirements.js +++ b/extension/src/requirements.js @@ -91,7 +91,8 @@ function fillRequirementSlots(courses, rows, substitutions = {}) { const outside = rows.filter(r => { const code = norm(r); if (named.has(code) || used.has(code) || seen.has(code)) return false; - seen.add(code); + // HK 12 repeats once per sport. + if (!/^(HK|PE)\b/.test(code)) seen.add(code); return true; }); // Specialization slots take only the courses their pool lists.