From 3a6e81b347b20353657733d19f0f59dd4fd5f3fa Mon Sep 17 00:00:00 2001 From: PixeL Date: Fri, 20 Dec 2024 00:14:06 -0600 Subject: [PATCH 1/2] Fix android support Android was failing because browser context menus are not supported. It works otherwise. I think some following updates should be made to make the UI more responsive/mobile friendly. --- shared/src/background.js | 47 +++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/shared/src/background.js b/shared/src/background.js index 14e844b..f930fba 100644 --- a/shared/src/background.js +++ b/shared/src/background.js @@ -265,28 +265,31 @@ 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); - } -}); + }); +} From 80a0b2c5c326f9c8eff0685e2951a140e6997dd0 Mon Sep 17 00:00:00 2001 From: PixeL Date: Fri, 20 Dec 2024 20:39:01 -0600 Subject: [PATCH 2/2] bump version --- firefox/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firefox/manifest.json b/firefox/manifest.json index 16112fc..9b5d5c3 100644 --- a/firefox/manifest.json +++ b/firefox/manifest.json @@ -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"