feat: add option to truncate long course descriptions to single line (default on, matches official PDF)

This commit is contained in:
adrianbonpin
2026-08-19 02:02:50 +08:00
parent b3b4495427
commit 106900860a
5 changed files with 57 additions and 4 deletions
+10
View File
@@ -18,6 +18,15 @@ $('#masterToggle').addEventListener('change', async (e) => {
$('#masterLabel').textContent = e.target.checked ? 'Enabled' : 'Disabled';
});
// ---- PDF settings: truncate long course descriptions (default ON) ----
async function loadTruncate() {
const { truncateDescription } = await browser.storage.local.get('truncateDescription');
$('#truncateToggle').checked = truncateDescription !== false;
}
$('#truncateToggle').addEventListener('change', async (e) => {
await browser.storage.local.set({ truncateDescription: e.target.checked });
});
// ---- Profiles ----
async function getProfiles() {
const { profiles } = await browser.storage.local.get(PROFILES_KEY);
@@ -104,5 +113,6 @@ $('#saveProfile').addEventListener('click', async () => {
// ---- Init ----
(async function init() {
await loadMaster();
await loadTruncate();
renderProfiles(await getProfiles());
})();