Skip to content

Commit

Permalink
Merge pull request Sulagna-Dutta-Roy#1376 from GAGGZ1/FindOnReddit
Browse files Browse the repository at this point in the history
Find on reddit
  • Loading branch information
Sulagna-Dutta-Roy authored Jun 9, 2024
2 parents cd61e0e + b043e01 commit 567b658
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Find On Reddit/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This script is optional and can be used for background tasks if needed

// Example: Listen for extension installation
chrome.runtime.onInstalled.addListener(function() {
console.log("Extension installed.");
});

// Example: Listen for messages from content scripts or other parts of the extension
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
if (message.action === "fetchRedditThreads") {
// You can perform background tasks here, if needed
// For example, you might want to make API requests to Reddit in the background
// Once you have the data, you can send a response back to the content script
sendResponse({ status: "success", data: "Reddit threads fetched successfully." });
}
});
Binary file added Find On Reddit/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Find On Reddit/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Find On Reddit/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions Find On Reddit/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"manifest_version": 3,
"name": "Find on Reddit",
"version": "1.0",
"description": "A browser extension to find Reddit submission threads related to the current webpage.",
"permissions": [
"activeTab",
"storage"
],
"background": {
"service_worker": "background.js"
},
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
"browser_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
}
}
}
16 changes: 16 additions & 0 deletions Find On Reddit/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Find on Reddit</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Find on Reddit</h1>
<p>Reddit threads related to the current webpage:</p>
<ul id="redditThreads"></ul>

<script src="popup.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions Find On Reddit/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
document.addEventListener('DOMContentLoaded', function() {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
var currentUrl = tabs[0].url;
fetchRedditThreads(currentUrl);
});
});

function fetchRedditThreads(url) {
// Use Reddit API to find submission threads related to the current URL
// Example API request: https://www.reddit.com/search.json?q=url:example.com
// Replace 'example.com' with the current URL
// Process the JSON response and populate the popup with relevant threads
}
15 changes: 15 additions & 0 deletions Find On Reddit/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* Add your CSS styles here */
body {
font-family: Arial, sans-serif;
line-height: 1.6;
}
h1 {
font-size: 1.5rem;
}
ul {
list-style-type: none;
padding: 0;
}
li {
margin-bottom: 10px;
}

0 comments on commit 567b658

Please sign in to comment.