Skip to content

Commit

Permalink
Fix submission menu on layout with description on right
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Mar 3, 2024
1 parent 331d8e2 commit b71a738
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions public/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ ytd-compact-playlist-renderer .ytd-compact-playlist-renderer #video-title:not(.c
width: 100%;
border-radius: 5px;
line-height: normal;
cursor: default;
}

.submissionMenuInner {
Expand Down
4 changes: 3 additions & 1 deletion src/submission/SubmissionComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ export const SubmissionComponent = (props: SubmissionComponentProps) => {

const thumbnailSubmissions = [...defaultThumbnails, ...extraUnsubmittedThumbnails, ...downloadedThumbnails];
return (
<div className="submissionMenuInner">
<div className="submissionMenuInner"
onClick={(e) => e.stopPropagation()}
onMouseDown={(e) => e.stopPropagation()}>
<BrandingPreviewComponent
submissions={props.submissions}
titles={titles}
Expand Down
13 changes: 13 additions & 0 deletions src/submission/submitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ export class SubmitButton {

close(): void {
if (this.container) {
// Experimental YouTube layout with description on right
const isOnDescriptionOnRightLayout = document.querySelector("#title #description");
if (isOnDescriptionOnRightLayout) {
// Undo preventing color from changing on hover
const title = document.querySelector("#above-the-fold #title") as HTMLElement | null;
if (title) {
title.style.removeProperty("background");
}
}

this.root?.unmount?.();
this.root = null;
this.container.remove();
Expand Down Expand Up @@ -108,6 +118,9 @@ export class SubmitButton {

if (isOnDescriptionOnRightLayout) {
this.container.style.marginTop = referenceNode.parentElement?.offsetHeight + "px";

// Prevent color from changing on hover
referenceNode.parentElement!.parentElement!.style.background = "transparent";
}

this.root = createRoot(this.container);
Expand Down

0 comments on commit b71a738

Please sign in to comment.