mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 14:37:23 +03:00
Remove text from category pills on mobile and don't make them take full height of title box
This commit is contained in:
@@ -198,6 +198,11 @@ div:hover > .sponsorBlockChapterBar {
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#categoryPill .sbPillNoText .sponsorSkipLogo {
|
||||||
|
margin-top: calc(2.6rem - 18px);
|
||||||
|
margin-bottom: calc(2.6rem - 18px);
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
from { opacity: 0; }
|
from { opacity: 0; }
|
||||||
}
|
}
|
||||||
@@ -772,6 +777,14 @@ input::-webkit-inner-spin-button {
|
|||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#categoryPillParent {
|
||||||
|
height: fit-content;
|
||||||
|
margin-top: auto;
|
||||||
|
margin-bottom: auto;
|
||||||
|
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.sponsorBlockCategoryPill {
|
.sponsorBlockCategoryPill {
|
||||||
border-radius: 25px;
|
border-radius: 25px;
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { getErrorMessage } from "../maze-utils/formating";
|
|||||||
|
|
||||||
export interface CategoryPillProps {
|
export interface CategoryPillProps {
|
||||||
vote: (type: number, UUID: SegmentUUID, category?: Category) => Promise<VoteResponse>;
|
vote: (type: number, UUID: SegmentUUID, category?: Category) => Promise<VoteResponse>;
|
||||||
|
showTextByDefault: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CategoryPillState {
|
export interface CategoryPillState {
|
||||||
@@ -43,7 +44,7 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<span style={style}
|
<span style={style}
|
||||||
className={"sponsorBlockCategoryPill"}
|
className={"sponsorBlockCategoryPill" + (!this.props.showTextByDefault ? " sbPillNoText" : "")}
|
||||||
aria-label={this.getTitleText()}
|
aria-label={this.getTitleText()}
|
||||||
onClick={(e) => this.toggleOpen(e)}
|
onClick={(e) => this.toggleOpen(e)}
|
||||||
onMouseEnter={() => this.openTooltip()}
|
onMouseEnter={() => this.openTooltip()}
|
||||||
@@ -52,9 +53,13 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
|||||||
<img className="sponsorSkipLogo sponsorSkipObject"
|
<img className="sponsorSkipLogo sponsorSkipObject"
|
||||||
src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}>
|
src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}>
|
||||||
</img>
|
</img>
|
||||||
|
|
||||||
|
{
|
||||||
|
(this.props.showTextByDefault || this.state.open) &&
|
||||||
<span className="sponsorBlockCategoryPillTitle">
|
<span className="sponsorBlockCategoryPillTitle">
|
||||||
{chrome.i18n.getMessage("category_" + this.state.segment?.category)}
|
{chrome.i18n.getMessage("category_" + this.state.segment?.category)}
|
||||||
</span>
|
</span>
|
||||||
|
}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{this.state.open && (
|
{this.state.open && (
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export class CategoryPill {
|
|||||||
|
|
||||||
this.root = createRoot(this.container);
|
this.root = createRoot(this.container);
|
||||||
this.ref = React.createRef();
|
this.ref = React.createRef();
|
||||||
this.root.render(<CategoryPillComponent ref={this.ref} vote={this.vote} />);
|
this.root.render(<CategoryPillComponent ref={this.ref} vote={this.vote} showTextByDefault={!this.onMobileYouTube} />);
|
||||||
|
|
||||||
if (this.onMobileYouTube) {
|
if (this.onMobileYouTube) {
|
||||||
if (this.mutationObserver) {
|
if (this.mutationObserver) {
|
||||||
@@ -76,6 +76,7 @@ export class CategoryPill {
|
|||||||
// Use a parent because YouTube does weird things to the top level object
|
// Use a parent because YouTube does weird things to the top level object
|
||||||
// react would have to rerender if container was the top level
|
// react would have to rerender if container was the top level
|
||||||
const parent = document.createElement("span");
|
const parent = document.createElement("span");
|
||||||
|
parent.id = "categoryPillParent";
|
||||||
parent.appendChild(this.container);
|
parent.appendChild(this.container);
|
||||||
|
|
||||||
referenceNode.prepend(parent);
|
referenceNode.prepend(parent);
|
||||||
|
|||||||
Reference in New Issue
Block a user