diff --git a/submissions/ClickToLens/README.md b/submissions/ClickToLens/README.md new file mode 100644 index 00000000..d56d6dc6 --- /dev/null +++ b/submissions/ClickToLens/README.md @@ -0,0 +1,32 @@ +# ClickToLens + +ClickToLens is a Chrome extension that allows you to quickly capture any with a right-click and analyze the image using various image search engines. + +**Supported search engines:** + +* Google Lens +* Yandex Images +* Bing Images +* TinEye + +## Installation + +1. Download the extension files from the repository. +2. Open Chrome and navigate to `chrome://extensions/`. +3. Enable "Developer mode" in the top right corner. +4. Click "Load unpacked" and select the directory containing the extension files. + +## Usage + +1. Right-click on any image. +2. Select "ClickToLens" from the context menu. +3. Choose the search engine you want to use to analyze the captured image. +4. The image will be automatically sent to the selected search engine, and the results will be displayed in a new tab. + +## Contributing + +Contributions are welcome! Please open an issue or submit a pull request. + +## License + +This project is licensed under the MIT License. diff --git a/submissions/ClickToLens/background.js b/submissions/ClickToLens/background.js new file mode 100644 index 00000000..59324d6e --- /dev/null +++ b/submissions/ClickToLens/background.js @@ -0,0 +1,73 @@ +chrome.runtime.onInstalled.addListener(() => { + chrome.contextMenus.create({ + id: "searchWithGoogleLens", + title: "Search with Google Lens", + contexts: ["image"] + }); + + chrome.contextMenus.create({ + id: "searchOtherEnginesParent", + title: "Search with Other Engines", + contexts: ["image"] + }); + + chrome.contextMenus.create({ + id: "searchBingImages", + title: "Bing Images", + parentId: "searchOtherEnginesParent", + contexts: ["image"] + }); + + chrome.contextMenus.create({ + id: "searchYandexImages", + title: "Yandex Images", + parentId: "searchOtherEnginesParent", + contexts: ["image"] + }); + + chrome.contextMenus.create({ + id: "searchTinEye", + title: "TinEye", + parentId: "searchOtherEnginesParent", + contexts: ["image"] + }); +}); + +chrome.contextMenus.onClicked.addListener((info, tab) => { + if (info.menuItemId === "searchOtherEnginesParent") { + return; + } + + const imageUrl = info.srcUrl; + let searchUrl = ''; + + if (!imageUrl) { + console.error("No image URL found for the clicked item."); + return; + } + + switch (info.menuItemId) { + case "searchWithGoogleLens": + searchUrl = `https://lens.google.com/uploadbyurl?url=${encodeURIComponent(imageUrl)}`; + break; + case "searchBingImages": + searchUrl = `https://www.bing.com/images/search?view=detailv2&iss=SBI&form=SBIIRP&sbisrc=UrlPaste&q=imgurl:${encodeURIComponent(imageUrl)}`; + break; + case "searchYandexImages": + searchUrl = `https://yandex.com/images/search?url=${encodeURIComponent(imageUrl)}&rpt=imageview`; + break; + case "searchTinEye": + searchUrl = `https://tineye.com/search?url=${encodeURIComponent(imageUrl)}`; + break; + default: + console.error("Unknown menu item ID clicked:", info.menuItemId); + return; + } + + if (searchUrl) { + chrome.tabs.create({ + url: searchUrl, + index: tab.index + 1 + }); + } +}); diff --git a/submissions/ClickToLens/icons/icon128.png b/submissions/ClickToLens/icons/icon128.png new file mode 100644 index 00000000..2e92f89e Binary files /dev/null and b/submissions/ClickToLens/icons/icon128.png differ diff --git a/submissions/ClickToLens/icons/icon16.png b/submissions/ClickToLens/icons/icon16.png new file mode 100644 index 00000000..656a592f Binary files /dev/null and b/submissions/ClickToLens/icons/icon16.png differ diff --git a/submissions/ClickToLens/icons/icon48.png b/submissions/ClickToLens/icons/icon48.png new file mode 100644 index 00000000..eabac432 Binary files /dev/null and b/submissions/ClickToLens/icons/icon48.png differ diff --git a/submissions/ClickToLens/manifest.json b/submissions/ClickToLens/manifest.json new file mode 100644 index 00000000..3c955367 --- /dev/null +++ b/submissions/ClickToLens/manifest.json @@ -0,0 +1,17 @@ +{ + "manifest_version": 3, + "name": "ClickToLens", + "version": "1.0", + "description": "Search any image with Google Lens and other search engines", + "permissions": [ + "contextMenus" + ], + "background": { + "service_worker": "background.js" + }, + "icons": { + "16": "icons/icon16.png", + "48": "icons/icon48.png", + "128": "icons/icon128.png" + } +}