Skip to content

Commit

Permalink
merged with upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fvirdia committed Jan 21, 2025
2 parents ac948be + 80a0b2c commit 9284a7c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion firefox/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Kagi Search for Firefox",
"version": "0.7.3.1",
"version": "0.7.4",
"description": "A simple helper extension for setting Kagi as a default search engine, and automatically logging in to Kagi in incognito browsing windows.",
"background": {
"page": "src/background_page.html"
Expand Down
47 changes: 25 additions & 22 deletions shared/src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,31 +292,34 @@ function kagiImageSearch(info) {
});
}

// Create a context menu item.
browser.contextMenus.create({
id: 'kagi-summarize',
title: 'Kagi Summarize',
contexts: ['link', 'page'], // Show the menu item when clicked on a link or elsewhere on page with no matching contexts
});
// FF Android does not support context menus
if (browser.contextMenus !== undefined) {
// Create a context menu item.
browser.contextMenus.create({
id: 'kagi-summarize',
title: 'Kagi Summarize',
contexts: ['link', 'page'], // Show the menu item when clicked on a link or elsewhere on page with no matching contexts
});

browser.contextMenus.create({
id: 'kagi-image-search',
title: 'Kagi Image Search',
contexts: ['image'],
});
browser.contextMenus.create({
id: 'kagi-image-search',
title: 'Kagi Image Search',
contexts: ['image'],
});

// Add a listener for the context menu item.
browser.contextMenus.onClicked.addListener(async (info, tab) => {
if (info.menuItemId === 'kagi-summarize') {
if (!IS_CHROME) {
// Attach permission request to user input handler for Firefox
await requestActiveTabPermission();
// Add a listener for the context menu item.
browser.contextMenus.onClicked.addListener(async (info, tab) => {
if (info.menuItemId === 'kagi-summarize') {
if (!IS_CHROME) {
// Attach permission request to user input handler for Firefox
await requestActiveTabPermission();
}
kagiSummarize(info, tab);
} else if (info.menuItemId === 'kagi-image-search') {
kagiImageSearch(info, tab);
}
kagiSummarize(info, tab);
} else if (info.menuItemId === 'kagi-image-search') {
kagiImageSearch(info, tab);
}
});
});
}

// Communication with Kagi Privacy Pass extension

Expand Down

0 comments on commit 9284a7c

Please sign in to comment.