feat: initial release of Brightwheel Memories & Reports Exporter Chrome extension
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const statusDot = document.getElementById('statusDot');
|
||||
const statusTitle = document.getElementById('statusTitle');
|
||||
const statusSubtitle = document.getElementById('statusSubtitle');
|
||||
const openDashboardBtn = document.getElementById('openDashboardBtn');
|
||||
|
||||
// Check active tab
|
||||
try {
|
||||
const [activeTab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||
|
||||
if (activeTab && activeTab.url && activeTab.url.includes('schools.mybrightwheel.com')) {
|
||||
statusDot.classList.add('online');
|
||||
statusTitle.textContent = 'Brightwheel Active Tab';
|
||||
statusSubtitle.textContent = 'Logged in session detected';
|
||||
} else {
|
||||
// Check if any Brightwheel tab exists in the browser
|
||||
const bwTabs = await chrome.tabs.query({ url: 'https://schools.mybrightwheel.com/*' });
|
||||
if (bwTabs && bwTabs.length > 0) {
|
||||
statusDot.classList.add('online');
|
||||
statusTitle.textContent = 'Brightwheel Tab Found';
|
||||
statusSubtitle.textContent = 'Ready to export';
|
||||
} else {
|
||||
statusTitle.textContent = 'Brightwheel Not Open';
|
||||
statusSubtitle.textContent = 'Dashboard will open login tab';
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error querying tabs:', err);
|
||||
}
|
||||
|
||||
// Open Dashboard Button Handler
|
||||
openDashboardBtn.addEventListener('click', async () => {
|
||||
await chrome.runtime.sendMessage({ action: 'OPEN_DASHBOARD' });
|
||||
window.close();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user