Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Research Rover Extension #2597

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Research Rover Extension/background.js
Original file line number Diff line number Diff line change
@@ -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;
});

11 changes: 11 additions & 0 deletions Research Rover Extension/content.js
Original file line number Diff line number Diff line change
@@ -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() });
}
});

34 changes: 34 additions & 0 deletions Research Rover Extension/manifest.json
Original file line number Diff line number Diff line change
@@ -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": ["<all_urls>"],
"js": ["content.js"]
}
],
"icons": {
"16": "images/icon16.png",
"48": "images/icon48.png",
"128": "images/icon128.png"
}
}

17 changes: 17 additions & 0 deletions Research Rover Extension/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ResearchRover</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h2>ResearchRover</h2>
<button id="summarize">Summarize This Page</button>
<div id="summary"></div>
</div>
<script src="popup.js"></script>
</body>
</html>
10 changes: 10 additions & 0 deletions Research Rover Extension/popup.js
Original file line number Diff line number Diff line change
@@ -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;
});
});
});
});

47 changes: 47 additions & 0 deletions Research Rover Extension/styles.css
Original file line number Diff line number Diff line change
@@ -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;
}
Loading