Skip to content
Open
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
3 changes: 3 additions & 0 deletions submissions/Judge This Website/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
chrome.runtime.onInstalled.addListener(() => {
console.log("Judge This Website extension installed.");
});
18 changes: 18 additions & 0 deletions submissions/Judge This Website/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"manifest_version": 3,
"name": "Judge This Website",
"version": "1.0",
"description": "Let people personally judge the websites they visit.",
"permissions": ["tabs", "storage"],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
},
"background": {
"service_worker": "background.js"
}
}
20 changes: 20 additions & 0 deletions submissions/Judge This Website/popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
body {
font-family: Arial, sans-serif;
padding: 10px;
width: 300px;
}

h1 {
font-size: 18px;
margin-bottom: 10px;
}

textarea {
width: 100%;
}

button {
margin-top: 10px;
padding: 5px 10px;
cursor: pointer;
}
26 changes: 26 additions & 0 deletions submissions/Judge This Website/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Judge This Website</title>
<link rel="stylesheet" href="popup.css">
</head>
<body>
<h1>Judge This Website</h1>
<div id="site"></div>
<label for="rating">Your Judgment:</label>
<select id="rating">
<option value="good">Good</option>
<option value="bad">Bad</option>
<option value="neutral">Neutral</option>
</select>
<br><br>
<textarea id="comment" placeholder="Leave a comment..." rows="4" cols="30"></textarea>
<br><br>
<button id="submit">Submit</button>

<h2>Previous Judgment</h2>
<div id="previous"></div>

<script src="popup.js"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions submissions/Judge This Website/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
document.addEventListener('DOMContentLoaded', async () => {
let [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
let url = new URL(tab.url);
let domain = url.hostname;

document.getElementById('site').textContent = domain;

chrome.storage.local.get([domain], (result) => {
if (result[domain]) {
document.getElementById('previous').innerHTML = `
<strong>Judgment:</strong> ${result[domain].rating}<br>
<strong>Comment:</strong> ${result[domain].comment}
`;
} else {
document.getElementById('previous').textContent = "No judgment yet.";
}
});

document.getElementById('submit').addEventListener('click', () => {
let rating = document.getElementById('rating').value;
let comment = document.getElementById('comment').value;

let data = { rating, comment };

chrome.storage.local.set({ [domain]: data }, () => {
alert('Your judgment has been saved!');
location.reload();
});
});
});