feat: extension skeleton with manifest, settings module, and placeholder icons
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
0
content/main.js
Normal file
0
content/main.js
Normal file
0
content/styles/badges.css
Normal file
0
content/styles/badges.css
Normal file
0
content/tweaks/badges.js
Normal file
0
content/tweaks/badges.js
Normal file
BIN
icons/icon-48.png
Normal file
BIN
icons/icon-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 142 B |
BIN
icons/icon-96.png
Normal file
BIN
icons/icon-96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 231 B |
46
lib/settings.js
Normal file
46
lib/settings.js
Normal file
@@ -0,0 +1,46 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const DEFAULTS = {
|
||||
enabled: true,
|
||||
darkMode: "auto",
|
||||
"light.subredditBgColor": "transparent",
|
||||
"light.subredditBorderColor": "#c84a20",
|
||||
"light.subredditTextColor": "#c84a20",
|
||||
"light.commentsBgColor": "#e0e0e0",
|
||||
"light.commentsBorderColor": "#4a4a4a",
|
||||
"light.commentsTextColor": "#4a4a4a",
|
||||
"dark.subredditBgColor": "transparent",
|
||||
"dark.subredditBorderColor": "#ff6b3d",
|
||||
"dark.subredditTextColor": "#ff6b3d",
|
||||
"dark.commentsBgColor": "#3a3a3a",
|
||||
"dark.commentsBorderColor": "#888888",
|
||||
"dark.commentsTextColor": "#cccccc",
|
||||
subredditColors: {},
|
||||
};
|
||||
|
||||
async function loadSettings() {
|
||||
const stored = await browser.storage.local.get(null);
|
||||
return Object.assign({}, DEFAULTS, stored);
|
||||
}
|
||||
|
||||
async function saveSettings(settings) {
|
||||
const toStore = {};
|
||||
for (const key of Object.keys(settings)) {
|
||||
if (key in DEFAULTS) {
|
||||
toStore[key] = settings[key];
|
||||
}
|
||||
}
|
||||
await browser.storage.local.set(toStore);
|
||||
}
|
||||
|
||||
async function resetSettings() {
|
||||
await browser.storage.local.clear();
|
||||
}
|
||||
|
||||
window.RedditTweaks = window.RedditTweaks || {};
|
||||
window.RedditTweaks.DEFAULTS = DEFAULTS;
|
||||
window.RedditTweaks.loadSettings = loadSettings;
|
||||
window.RedditTweaks.saveSettings = saveSettings;
|
||||
window.RedditTweaks.resetSettings = resetSettings;
|
||||
})();
|
||||
28
manifest.json
Normal file
28
manifest.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Reddit Tweaks",
|
||||
"version": "1.0.0",
|
||||
"description": "Reskins old Reddit post listings with badge-style subreddit and comment indicators.",
|
||||
"permissions": ["storage", "activeTab"],
|
||||
"icons": {
|
||||
"48": "icons/icon-48.png",
|
||||
"96": "icons/icon-96.png"
|
||||
},
|
||||
"browser_action": {
|
||||
"default_icon": "icons/icon-48.png",
|
||||
"default_popup": "popup/popup.html",
|
||||
"default_title": "Reddit Tweaks Settings"
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["*://old.reddit.com/*", "*://www.reddit.com/*"],
|
||||
"css": ["content/styles/badges.css"],
|
||||
"js": [
|
||||
"lib/settings.js",
|
||||
"content/tweaks/badges.js",
|
||||
"content/main.js"
|
||||
],
|
||||
"run_at": "document_idle"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user