From 647014f00cc3cbe5995e9c3563886fbfaef5db10 Mon Sep 17 00:00:00 2001 From: Sree Vidya Date: Sun, 4 Aug 2024 11:48:38 +0530 Subject: [PATCH] Add files via upload --- Research Rover Extension/background.js | 13 +++++++ Research Rover Extension/content.js | 11 ++++++ Research Rover Extension/manifest.json | 34 +++++++++++++++++++ Research Rover Extension/popup.html | 17 ++++++++++ Research Rover Extension/popup.js | 10 ++++++ Research Rover Extension/styles.css | 47 ++++++++++++++++++++++++++ 6 files changed, 132 insertions(+) create mode 100644 Research Rover Extension/background.js create mode 100644 Research Rover Extension/content.js create mode 100644 Research Rover Extension/manifest.json create mode 100644 Research Rover Extension/popup.html create mode 100644 Research Rover Extension/popup.js create mode 100644 Research Rover Extension/styles.css diff --git a/Research Rover Extension/background.js b/Research Rover Extension/background.js new file mode 100644 index 00000000..2f400438 --- /dev/null +++ b/Research Rover Extension/background.js @@ -0,0 +1,13 @@ +chrome.runtime.onInstalled.addListener(() => { + console.log("ResearchRover installed and ready to assist!"); + }); + + chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { + if (message.action === "summarize") { + // Example summarization logic (replace with actual API or algorithm) + let summary = message.content.split(' ').slice(0, 50).join(' ') + '...'; // Simple truncation for demo purposes + sendResponse({ summary: summary }); + } + return true; + }); + \ No newline at end of file diff --git a/Research Rover Extension/content.js b/Research Rover Extension/content.js new file mode 100644 index 00000000..27c9bb8b --- /dev/null +++ b/Research Rover Extension/content.js @@ -0,0 +1,11 @@ +function extractContent() { + let content = document.body.innerText; + return content; + } + + chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { + if (message.action === "getContent") { + sendResponse({ content: extractContent() }); + } + }); + \ No newline at end of file diff --git a/Research Rover Extension/manifest.json b/Research Rover Extension/manifest.json new file mode 100644 index 00000000..84468818 --- /dev/null +++ b/Research Rover Extension/manifest.json @@ -0,0 +1,34 @@ +{ + "manifest_version": 3, + "name": "ResearchRover", + "version": "1.0", + "description": "Gather and summarize web content effortlessly, streamlining your research process with automated insights.", + "permissions": [ + "activeTab", + "scripting", + "storage" + ], + "action": { + "default_popup": "popup.html", + "default_icon": { + "16": "images/icon16.png", + "48": "images/icon48.png", + "128": "images/icon128.png" + } + }, + "background": { + "service_worker": "background.js" + }, + "content_scripts": [ + { + "matches": [""], + "js": ["content.js"] + } + ], + "icons": { + "16": "images/icon16.png", + "48": "images/icon48.png", + "128": "images/icon128.png" + } + } + \ No newline at end of file diff --git a/Research Rover Extension/popup.html b/Research Rover Extension/popup.html new file mode 100644 index 00000000..d6909bca --- /dev/null +++ b/Research Rover Extension/popup.html @@ -0,0 +1,17 @@ + + + + + + ResearchRover + + + +
+

ResearchRover

+ +
+
+ + + diff --git a/Research Rover Extension/popup.js b/Research Rover Extension/popup.js new file mode 100644 index 00000000..09ac1da9 --- /dev/null +++ b/Research Rover Extension/popup.js @@ -0,0 +1,10 @@ +document.getElementById("summarize").addEventListener("click", () => { + chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { + chrome.tabs.sendMessage(tabs[0].id, { action: "getContent" }, (response) => { + chrome.runtime.sendMessage({ action: "summarize", content: response.content }, (response) => { + document.getElementById("summary").innerText = response.summary; + }); + }); + }); + }); + \ No newline at end of file diff --git a/Research Rover Extension/styles.css b/Research Rover Extension/styles.css new file mode 100644 index 00000000..b52b1d4b --- /dev/null +++ b/Research Rover Extension/styles.css @@ -0,0 +1,47 @@ +body { + font-family: 'Arial', sans-serif; + margin: 0; + padding: 0; + background: linear-gradient(120deg, #fdfbfb, #ebedee); + width: 300px; +} + +.container { + padding: 20px; + text-align: center; +} + +h2 { + color: #444; + font-size: 24px; + margin-bottom: 20px; +} + +button { + background-color: #6200ea; + color: white; + border: none; + padding: 10px 20px; + font-size: 16px; + cursor: pointer; + border-radius: 25px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + transition: background-color 0.3s ease; +} + +button:hover { + background-color: #3700b3; +} + +#summary { + margin-top: 20px; + padding: 15px; + background: #f1f1f1; + border-radius: 10px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + color: #333; + font-size: 14px; + text-align: left; + max-height: 150px; + overflow-y: auto; +}