mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
(() =>
|
|
{
|
|
return (settings, resources) =>
|
|
{
|
|
(async () =>
|
|
{
|
|
const dropdown = await SpinQuery.select(() => document.querySelector(`input[key=defaultPlayerLayout]`));
|
|
if (!dropdown)
|
|
{
|
|
return;
|
|
}
|
|
const cookieKey = "stardustvideo";
|
|
const oldLayout = "旧版";
|
|
const newLayout = "新版";
|
|
const cookieValues = {
|
|
[oldLayout]: 0,
|
|
// "新版1": 1,
|
|
[newLayout]: 2,
|
|
};
|
|
const currentLayout = document.cookie.split(";")
|
|
.filter(it => it.includes(cookieKey + "=0")).length > 0 ? oldLayout : newLayout;
|
|
|
|
function setLayout(layoutName)
|
|
{
|
|
document.cookie = `${cookieKey}=${cookieValues[layoutName]};path=/;domain=.bilibili.com;max-age=31536000`;
|
|
window.location.reload();
|
|
}
|
|
$(dropdown).on("change", () =>
|
|
{
|
|
setLayout(dropdown.value);
|
|
});
|
|
if (settings.defaultPlayerLayout !== currentLayout)
|
|
{
|
|
setLayout(settings.defaultPlayerLayout);
|
|
}
|
|
})();
|
|
};
|
|
})(); |