Files
bitrix24-my-time/extension/options.js
T
Alex CubeandClaude Opus 5.5 c701f07483 Расширение «Моё время в Битрикс24»
Часы по задачам за месяц и остаток до нормы, через REST от сессии браузера.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:14:06 +03:00

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 = 'Сохранено';
};