Часы по задачам за месяц и остаток до нормы, через REST от сессии браузера. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
736 B
JavaScript
24 lines
736 B
JavaScript
const portal = document.getElementById('portal');
|
|
const norm = document.getElementById('norm');
|
|
const status = document.getElementById('status');
|
|
|
|
chrome.storage.sync.get({ portal: '', norm: 0 }, cfg => {
|
|
portal.value = cfg.portal;
|
|
norm.value = cfg.norm || '';
|
|
});
|
|
|
|
document.getElementById('save').onclick = async () => {
|
|
let p = portal.value.trim();
|
|
if (p) {
|
|
try {
|
|
p = new URL(p.includes('://') ? p : 'https://' + p).origin + '/';
|
|
} catch {
|
|
status.textContent = 'Адрес портала не похож на адрес';
|
|
return;
|
|
}
|
|
}
|
|
await chrome.storage.sync.set({ portal: p, norm: Math.max(0, Number(norm.value) || 0) });
|
|
portal.value = p;
|
|
status.textContent = 'Сохранено';
|
|
};
|