-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: mf-5058 adjust wrapped article info bar (#10848)
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
packages/mask/src/site-adaptors/mirror.xyz/injection/Tips/adjustArticleInfoBar.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function selector() { | ||
const authorWallet = location.pathname.split('/')[1].toLowerCase() | ||
return `#__next div:has(> div > a[href$="mirror.xyz/${authorWallet}" i] button[data-state] img[alt^="0x" i]) + div` | ||
} | ||
|
||
export function adjustArticleInfoBar(signal: AbortSignal) { | ||
const node = document.querySelector<HTMLDivElement>(selector()) | ||
if (!node) return | ||
const timer = setInterval(() => { | ||
if (node.offsetWidth !== node.parentElement?.offsetWidth) return | ||
node.style.justifyContent = 'flex-start' | ||
clearInterval(timer) | ||
}, 250) | ||
signal.addEventListener('abort', () => clearInterval(timer)) | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/mask/src/site-adaptors/mirror.xyz/injection/Tips/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { injectOnMenu } from './MenuAuthorTipButton.js' | ||
import { injectOnVerification } from './PostVerification.js' | ||
import { injectTipsButtonOnProfile as injectOnProfile } from './ProfilePage.js' | ||
import { adjustArticleInfoBar } from './adjustArticleInfoBar.js' | ||
|
||
export function injectTips(signal: AbortSignal) { | ||
injectOnMenu(signal) | ||
injectOnProfile(signal) | ||
injectOnVerification(signal) | ||
adjustArticleInfoBar(signal) | ||
} |