aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest.json36
-rw-r--r--popup.html166
-rw-r--r--popup.js48
-rw-r--r--unhook.js34
4 files changed, 284 insertions, 0 deletions
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..4554270
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,36 @@
+{
+ "manifest_version": 2,
+ "name": "Unhook NG",
+ "version": "1",
+
+ "description": "New version of Unhook. Block Youtube Distractions.",
+
+ "icons": {
+ "48": "icons/unhook.jpg"
+ },
+
+ "permissions": [
+ "storage"
+ ],
+
+ "browser_action": {
+ "default_icon": "icons/unhook.jpg",
+ "default_title": "Unhook NG",
+ "default_popup": "popup.html"
+ },
+
+ "content_scripts": [
+ {
+ "matches": ["*://*.youtube.com/*"],
+ "js": ["unhook.js"]
+ }
+ ],
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "@unhookng",
+ "data_collection_permissions": {
+ "required": ["none"]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/popup.html b/popup.html
new file mode 100644
index 0000000..e6b4ed4
--- /dev/null
+++ b/popup.html
@@ -0,0 +1,166 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <style>
+ body {
+ width: 240px;
+ padding: 12px;
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
+ font-size: 13px;
+ background: #1a1a1a;
+ color: #fff;
+ margin: 0;
+ }
+
+ h3 {
+ margin: 0 0 10px 0;
+ font-size: 14px;
+ color: #ff4444;
+ }
+
+ label {
+ display: flex;
+ align-items: center;
+ padding: 4px 0;
+ cursor: pointer;
+ }
+
+ label:hover {
+ background: #333;
+ }
+
+ label.sub {
+ padding-left: 20px;
+ font-size: 12px;
+ color: #aaa;
+ }
+
+ input[type="checkbox"] {
+ margin-right: 8px;
+ accent-color: #ff4444;
+ }
+ </style>
+</head>
+<body>
+ <h3>Unhook NG</h3>
+
+ <label>
+ <input type="checkbox" id="hideHomeFeed" checked>
+ Hide Home Feed
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideVideoSidebar" checked>
+ Hide Video Sidebar
+ </label>
+ <label class="sub">
+ <input type="checkbox" id="hideRecommended" checked>
+ Hide Recommended
+ </label>
+ <label class="sub">
+ <input type="checkbox" id="hideLiveChat" checked>
+ Hide Live Chat
+ </label>
+ <label class="sub">
+ <input type="checkbox" id="hidePlaylist" checked>
+ Hide Playlist
+ </label>
+ <label class="sub">
+ <input type="checkbox" id="hideFundraiser" checked>
+ Hide Fundraiser
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideEndScreenFeed" checked>
+ Hide End Screen Feed
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideEndScreenCards" checked>
+ Hide End Screen Cards
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideShorts" checked>
+ Hide Shorts
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideComments" checked>
+ Hide Comments
+ </label>
+ <label class="sub">
+ <input type="checkbox" id="hideProfilePhotos" checked>
+ Hide Profile Photos
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideMixes" checked>
+ Hide Mixes
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideMerchTickets" checked>
+ Hide Merch, Tickets, Offers
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideVideoInfo" checked>
+ Hide Video Info
+ </label>
+ <label class="sub">
+ <input type="checkbox" id="hideButtonsBar" checked>
+ Hide Buttons Bar
+ </label>
+ <label class="sub">
+ <input type="checkbox" id="hideChannel" checked>
+ Hide Channel
+ </label>
+ <label class="sub">
+ <input type="checkbox" id="hideDescription" checked>
+ Hide Description
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideTopHeader" checked>
+ Hide Top Header
+ </label>
+ <label class="sub">
+ <input type="checkbox" id="hideNotifications" checked>
+ Hide Notifications
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideInaptSearch" checked>
+ Hide Inapt Search Results
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideExploreTrending" checked>
+ Hide Explore, Trending
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideMoreFromYT" checked>
+ Hide More from YouTube
+ </label>
+
+ <label>
+ <input type="checkbox" id="hideSubscriptions" checked>
+ Hide Subscriptions
+ </label>
+
+ <label>
+ <input type="checkbox" id="disableAutoplay" checked>
+ Disable Autoplay
+ </label>
+
+ <label>
+ <input type="checkbox" id="disableAnnotations" checked>
+ Disable Annotations
+ </label>
+
+ <script src="popup.js"></script>
+</body>
+</html>
diff --git a/popup.js b/popup.js
new file mode 100644
index 0000000..816f785
--- /dev/null
+++ b/popup.js
@@ -0,0 +1,48 @@
+const toggles = [
+ 'hideHomeFeed',
+ 'hideVideoSidebar',
+ 'hideRecommended',
+ 'hideLiveChat',
+ 'hidePlaylist',
+ 'hideFundraiser',
+ 'hideEndScreenFeed',
+ 'hideEndScreenCards',
+ 'hideShorts',
+ 'hideComments',
+ 'hideProfilePhotos',
+ 'hideMixes',
+ 'hideMerchTickets',
+ 'hideVideoInfo',
+ 'hideButtonsBar',
+ 'hideChannel',
+ 'hideDescription',
+ 'hideTopHeader',
+ 'hideNotifications',
+ 'hideInaptSearch',
+ 'hideExploreTrending',
+ 'hideMoreFromYT',
+ 'hideSubscriptions',
+ 'disableAutoplay',
+ 'disableAnnotations'
+];
+
+// Load saved settings
+browser.storage.local.get(toggles).then((result) => {
+ toggles.forEach((id) => {
+ const checkbox = document.getElementById(id);
+ if (checkbox) {
+ checkbox.checked = result[id] !== false;
+ }
+ });
+});
+
+// Save settings on change
+document.addEventListener('change', (e) => {
+ if (e.target.type !== 'checkbox') return;
+
+ const id = e.target.id;
+ const checked = e.target.checked;
+ const settings = { [id]: checked };
+
+ browser.storage.local.set(settings);
+});
diff --git a/unhook.js b/unhook.js
new file mode 100644
index 0000000..05c073f
--- /dev/null
+++ b/unhook.js
@@ -0,0 +1,34 @@
+// Single stylesheet for all hiding rules
+let styleElement = null;
+
+function applyStyles(settings) {
+ if (!styleElement) {
+ styleElement = document.createElement('style');
+ styleElement.id = 'unhook-styles';
+ document.head.appendChild(styleElement);
+ }
+
+ const rules = [];
+
+ if (settings.hideVideoSidebar) rules.push('#secondary { display: none !important; }')
+ if (settings.hideRecommended) rules.push('#related { display: none !important; }');
+ if (settings.hideLiveChat) rules.push('#chat-container { display: none !important; }');
+ if (settings.hidePlaylist) rules.push('#playlist { display: none !important; }');
+ if (settings.hideFundraiser) rules.push('#donation-shelf { display: none !important; }');
+
+
+ styleElement.textContent = rules.join('\n');
+}
+
+async function main() {
+ const settings = await browser.storage.local.get(null);
+ applyStyles(settings);
+}
+
+// Content scripts run after DOM is ready by default, so call main directly
+main();
+
+// Listen for storage changes and reapply all settings
+browser.storage.onChanged.addListener(() => {
+ main();
+});