diff --git a/background.js b/background.js
index 15556bf..964e290 100644
--- a/background.js
+++ b/background.js
@@ -41,6 +41,56 @@ chrome.runtime.onInstalled.addListener(() => {
}
});
+// The overlay HTML structure
+const overlayHTML = `
+
+
+
+ Press [Esc] to exit
+
+
+
+
+`;
+
+// Function to show the overlay
+function showOverlay(tabId) {
+ chrome.scripting.executeScript({
+ target: { tabId: tabId },
+ func: function(overlayContent) {
+ // Check if overlay already exists
+ if (document.getElementById('openai-overlay')) {
+ document.getElementById('openai-overlay').remove();
+ return;
+ }
+
+ const overlay = document.createElement('div');
+ overlay.innerHTML = overlayContent;
+ document.body.appendChild(overlay);
+
+ const textbox = document.getElementById('openai-textbox');
+ textbox.focus();
+
+ textbox.addEventListener('keydown', function(e) {
+ if (e.key === 'Enter' && e.shiftKey) {
+ // Handle the "Search with OpenAI" functionality here
+ // For now, just hide the overlay
+ document.getElementById('openai-overlay').remove();
+ }
+ });
+
+ // Close overlay on Esc key press
+ document.addEventListener('keydown', function(e) {
+ if (e.key === 'Escape') {
+ document.getElementById('openai-overlay').remove();
+ }
+ });
+ },
+ args: [overlayHTML]
+ });
+}
+
+
///////////////////////
//////////////////////
@@ -143,6 +193,17 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => {
}
});
+// Handle the Alt+Shift+K shortcut
+chrome.commands.onCommand.addListener(function(command) {
+ if (command === 'show-overlay') {
+ chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
+ if (tabs[0]) {
+ showOverlay(tabs[0].id);
+ }
+ });
+ }
+});
+
// Toggle extension functionality on icon click
chrome.action.onClicked.addListener((tab) => {
if (extensionStatus === 'off') {
diff --git a/manifest.json b/manifest.json
index 2f1714a..91388d7 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 3,
"author": "Sreecharan S. (sr2echa)",
"name": "ThottaThukiduven",
- "version": "1.03",
+ "version": "1.12",
"description": "Your ultimate tool for Getting AI response, unblock Copy/Paste and keep the window always active. Yk where you can use...",
"background": {
"service_worker": "background.js"
@@ -25,5 +25,14 @@
"js": ["data/inject/isolated.js", "data/inject/content.js", "data/inject/main.js"]
}
],
+ "commands": {
+ "show-overlay": {
+ "suggested_key": {
+ "default": "Alt+Shift+K"
+ },
+ "description": "Show OpenAI search overlay"
+ }
+ },
+
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA41rIOYBJkYaRSfAOUOWwgCe0X/0rW+Cn04kAuM1j2i0i461w5IodNoMQMOGixC8vK1hrDnxHVfgTh/NsYVK0Dl9I/BAiSdA8o3JWCMqqLk2ZMy4022lH+apQ0aDSmMJfrdLxS411N0Vyo3QCHisFy7cYfQAjc0z1KcuahkrPa6MoVSlJo6yN5601xR0ezeZiIeiweCqK4YKxziQ8dRSj6X5SQ1DXCDKfC8/1Ssam8cY2vn9GHm6ICL4nkPInZB8MBLdzjiEXxs9ciWrkxUfIOa5ewH1dXBeBSfll8ukM5G+5t3KxJyJM0JZLJZfVHWk5PZZLoa6YCja1YnUhUazXOQIDAQAB"
}