Skip to content

Commit 2f7ee98

Browse files
OsaSoftclaude
andcommitted
Add compact button layout setting (#181)
Add a setting to switch between two button placements: - Default: row below the video metadata (closest to original behavior) - Compact: positioned next to the triple dots menu button Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9bf5de6 commit 2f7ee98

File tree

5 files changed

+47
-22
lines changed

5 files changed

+47
-22
lines changed

common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const DEFAULT_SETTINGS = {
1818
"settings.hide.members.only": false,
1919
"settings.hide.most.relevant": false,
2020
"settings.hide.mark.watched.button": false,
21+
"settings.mark.watched.button.compact": false,
2122
"settings.changelog.auto.open": true,
2223
};
2324

pages/settings/settings.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,18 @@ <h3 class="settings-group__title">Interface</h3>
209209
</label>
210210
</div>
211211

212+
<div class="setting-item">
213+
<div class="setting-info">
214+
<span class="setting-title" id="setting-button-compact-title">Compact button layout</span>
215+
<span class="setting-description" id="setting-button-compact-desc">Place the button next to the menu instead of in a row below the metadata</span>
216+
</div>
217+
<label class="toggle">
218+
<input type="checkbox" id="settings.mark.watched.button.compact"
219+
aria-labelledby="setting-button-compact-title"
220+
aria-describedby="setting-button-compact-desc">
221+
<span class="toggle-slider"></span>
222+
</label>
223+
</div>
212224

213225
</div>
214226
</div>

subs.css

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,12 @@ ytd-grid-video-renderer.style-scope.ytd-grid-renderer:hover .subs-btn-mark-watch
8181
vertical-align: -3px;
8282
}
8383

84-
/* Make menu button container a positioning context */
85-
.yt-lockup-metadata-view-model__menu-button {
86-
position: relative;
87-
}
88-
89-
/* Button container positioned below the triple dots menu */
84+
/* Default button container: row below metadata */
9085
.subs-btn-container {
91-
position: absolute;
92-
top: 100%;
93-
right: 0;
9486
display: flex;
87+
justify-content: flex-start;
9588
align-items: center;
96-
padding: 0;
89+
padding: 4px 0;
9790
}
9891

9992
/* Button overrides inside container */
@@ -104,8 +97,20 @@ ytd-grid-video-renderer.style-scope.ytd-grid-renderer:hover .subs-btn-mark-watch
10497
height: 24px;
10598
}
10699

107-
/* Center the eye icon under the dots */
108-
.subs-btn-container:has(.subs-btn-mark-watched) {
100+
/* Compact layout: positioned below the triple dots menu */
101+
.yt-lockup-metadata-view-model__menu-button {
102+
position: relative;
103+
}
104+
105+
.subs-btn-container--compact {
106+
position: absolute;
107+
top: 100%;
108+
right: 0;
109+
padding: 0;
110+
}
111+
112+
/* Center the eye icon under the dots in compact mode */
113+
.subs-btn-container--compact:has(.subs-btn-mark-watched) {
109114
left: 50%;
110115
right: auto;
111116
transform: translateX(-50%);

tests/setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const DEFAULT_SETTINGS = {
2424
"settings.hide.members.only": false,
2525
"settings.hide.most.relevant": false,
2626
"settings.hide.mark.watched.button": false,
27+
"settings.mark.watched.button.compact": false,
2728
"settings.changelog.auto.open": true,
2829
};
2930

videos/SubscriptionsVideo.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,34 @@ class SubscriptionVideo extends Video {
4545
let markButton = buildMarkWatchedButton(buttonContainer, this.containingDiv, this.videoId, !this.isStored);
4646

4747
// Insert button in a container
48-
let strip = document.createElement("div");
49-
strip.classList.add("subs-btn-container");
50-
strip.appendChild(markButton);
48+
let container = document.createElement("div");
49+
container.classList.add("subs-btn-container");
50+
container.appendChild(markButton);
5151

5252
// Detect new lockup layout by presence of vertical container
5353
let verticalDiv = this.contentDiv.querySelector(".yt-lockup-view-model--vertical");
5454
if (verticalDiv) {
55-
// New layout: place inside the menu button container (next to triple dots)
56-
let menuButtonDiv = verticalDiv.querySelector(".yt-lockup-metadata-view-model__menu-button");
57-
if (menuButtonDiv) {
58-
menuButtonDiv.appendChild(strip);
55+
if (settings["settings.mark.watched.button.compact"]) {
56+
// Compact layout: place inside the menu button area (next to triple dots)
57+
container.classList.add("subs-btn-container--compact");
58+
let menuButtonDiv = verticalDiv.querySelector(".yt-lockup-metadata-view-model__menu-button");
59+
if (menuButtonDiv) {
60+
menuButtonDiv.appendChild(container);
61+
} else {
62+
verticalDiv.appendChild(container);
63+
}
5964
} else {
65+
// Default layout: insert after metadata div
6066
let metadataDiv = verticalDiv.querySelector(":scope > .yt-lockup-view-model__metadata");
6167
if (metadataDiv) {
62-
metadataDiv.appendChild(strip);
68+
metadataDiv.after(container);
6369
} else {
64-
verticalDiv.appendChild(strip);
70+
verticalDiv.appendChild(container);
6571
}
6672
}
6773
} else {
6874
// Old layout: insert before title area
69-
buttonContainer.insertBefore(strip, buttonContainer.querySelector("#video-title")?.parentElement || buttonContainer.firstChild);
75+
buttonContainer.insertBefore(container, buttonContainer.querySelector("#video-title")?.parentElement || buttonContainer.firstChild);
7076
}
7177
}
7278
}

0 commit comments

Comments
 (0)