Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions src/bilibili.com/components/FullHeaderButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,47 @@ export default class FullHeaderButton {
return;
}
const container = obtainHTMLElementByID({
tag: 'li',
tag: 'div',
id: FullHeaderButton.id,
onDidCreate: (el) => {
el.classList.add('right-entry-item');
parent.prepend(...[parent.firstChild, el].filter(isNonNull));
document.body.appendChild(el)
},
});
render(
html`
<button
type="button"
class="right-entry__outside"
style="
position: fixed;
bottom: 30px;
right: 30px;
z-index: 99999; /* 确保在最上层 */
display: flex;
align-items: center;
justify-content: center;
gap: 5px;
padding: 10px 16px;
background-color: white; /* 背景色,根据需要调整(如跟随夜间模式) */
color: #333; /* 文字颜色 */
border: 1px solid #e0e0e0;
border-radius: 50px; /* 圆角胶囊样式 */
box-shadow: 0 4px 12px rgba(0,0,0,0.15); /* 悬浮阴影 */
cursor: pointer;
transition: transform 0.2s;
"
/* 添加简单的鼠标悬停效果(可选,通过 onmouseenter/leave 模拟 CSS hover) */
@mouseenter=${(e) => e.currentTarget.style.transform = 'scale(1.05)'}
@mouseleave=${(e) => e.currentTarget.style.transform = 'scale(1)'}
@click=${(e: Event) => {
e.preventDefault();
e.stopPropagation();
this.settings.open();
}}
>
<svg viewBox="2 2 20 20" class="right-entry-icon" style="height: 20px; fill: currentColor;">
<svg viewBox="2 2 20 20" style="height: 20px; width: 20px; fill: currentColor;">
<path fill-rule="evenodd" clip-rule="evenodd" d=${mdiEyeOffOutline}>
</svg>
<span class="right-entry-text">屏蔽</span>
<span style="font-size: 14px; font-weight: 500;">屏蔽</span>
</button>
`,
container
Expand Down