Bilibili Level SVG

提供Bilibili等级(LV0-LV6及硬核会员)的SVG元素获取函数。

Ten skrypt nie powinien być instalowany bezpośrednio. Jest to biblioteka dla innych skyptów do włączenia dyrektywą meta // @require https://update.greasyfork.org/scripts/584803/1863155/Bilibili%20Level%20SVG.js

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Autor
ryxel
Wersja
1.0.0
Utworzono
29-06-2026
Zaktualizowano
29-06-2026
Rozmiar
11,5 KB
Licencja
MIT

一个获取 Bilibili 等级(LV0 ~ LV6 及硬核会员) SVG 元素的 JavaScript 库。

调用 getLevelSvg 函数并传入对应的等级(支持数字或字符串 0~6,硬核会员传入 'h'),即可返回解析后的 SVGElement DOM 元素。由于原始 SVG 未指定宽高,获取后需要自行设置尺寸才能正常显示。若传入无效等级则返回 null

// 使用示例
const lv6Svg = getLevelSvg(6);   // 返回 LV6 的 SVG 元素
const hcSvg = getLevelSvg('h');  // 返回硬核会员的 SVG 元素

// 必须设置尺寸,否则图标无法正常显示
lv6Svg.style.height = '20px';
lv6Svg.style.width = 'auto';

document.querySelector('.user-level-container').appendChild(lv6Svg);