Initial version
This commit is contained in:
commit
eaaad96bb3
14 changed files with 9889 additions and 0 deletions
23
background.js
Normal file
23
background.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Background service worker for Full Screenshot Selector Chrome Extension
|
||||
|
||||
// Handle keyboard shortcut
|
||||
chrome.commands.onCommand.addListener(async (command) => {
|
||||
if (command === 'activate-selector') {
|
||||
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||
|
||||
if (tab && tab.url && !tab.url.startsWith('chrome://') && !tab.url.startsWith('chrome-extension://')) {
|
||||
try {
|
||||
await chrome.tabs.sendMessage(tab.id, { action: 'activateFromShortcut' });
|
||||
} catch (error) {
|
||||
console.log('Could not activate selector on this page:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Handle extension installation
|
||||
chrome.runtime.onInstalled.addListener((details) => {
|
||||
if (details.reason === 'install') {
|
||||
console.log('Full Screenshot Selector installed');
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue