Расширение «Моё время в Битрикс24»

Часы по задачам за месяц и остаток до нормы, через REST от сессии браузера.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alex Cube
2026-10-26 01:14:06 +03:00
co-authored by Claude Opus 5.5
commit c701f07483
8 changed files with 252 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
chrome.runtime.onInstalled.addListener(({ reason }) => {
if (reason === 'install') chrome.runtime.openOptionsPage();
});
chrome.action.onClicked.addListener(async tab => {
const cfg = await chrome.storage.sync.get({ portal: '', norm: 0 });
if (cfg.portal && !(tab.url || '').startsWith(cfg.portal)) return chrome.tabs.create({ url: cfg.portal });
const target = { tabId: tab.id };
try {
// MAIN — чтобы скрипту были видны BX и сессия портала
await chrome.scripting.executeScript({ target, world: 'MAIN', func: c => { window.myTimeConfig = c; }, args: [cfg] });
await chrome.scripting.executeScript({ target, world: 'MAIN', files: ['mytime.js'] });
} catch {
chrome.runtime.openOptionsPage(); // служебная страница браузера, туда скрипт не пустят
}
});