forked from Sulagna-Dutta-Roy/GGExtensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Sulagna-Dutta-Roy#1376 from GAGGZ1/FindOnReddit
Find on reddit
- Loading branch information
Showing
8 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." }); | ||
} | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |