Clean up old files

This commit is contained in:
the1812 2021-02-06 15:13:38 +08:00
parent 0cd14931a8
commit 0d8fe09a93
82 changed files with 127 additions and 3542 deletions

View File

@ -1 +1 @@
(()=>(n,c)=>({widget:{content:`\n<button\n class="gui-settings-flat-button"\n id="clear-cache">\n<i class="icon-clear"></i>\n<span>清除缓存</span>\n</button>`,condition:()=>typeof offlineData==="undefined",success:()=>{$("#clear-cache").on("click",(()=>{n.cache={};Toast.success("已删除全部缓存.","清除缓存",5e3)}))}}}))();
(()=>(n,c)=>({widget:{content:`\n<button\n class="gui-settings-flat-button"\n id="clear-cache">\n<i class="icon-clear"></i>\n<span>清除缓存</span>\n</button>`,condition:()=>typeof offlineData==="undefined",success:()=>{var c;(c=dq("#clear-cache"))===null||c===void 0?void 0:c.addEventListener("click",(()=>{n.cache={};Toast.success("已删除全部缓存.","清除缓存",5e3)}))}}}))();

2
min/comment.min.js vendored
View File

@ -1 +1 @@
(()=>(e,t)=>{t.applyImportantStyle("useCommentStyleStyle");return{reload:()=>t.applyImportantStyle("useCommentStyleStyle"),unload:()=>t.removeStyle("useCommentStyleStyle")}})();
(()=>(e,t)=>t.toggleStyle("useCommentStyleStyle"))();

View File

@ -1 +1 @@
(()=>(o,t)=>{addSettingsListener("customControlBackgroundOpacity",(o=>{document.documentElement.style.setProperty("--custom-control-background-opacity",o)}),true);const n=()=>{t.applyStyle("customControlBackgroundStyle");if(!o.touchVideoPlayer){t.applyImportantStyleFromText(`\n<style id="control-background-non-touch">\n .bilibili-player-video-control-bottom\n {\n margin: 7px 0 0 0 !important;\n padding: 8px 0 0 !important;\n }\n</style>\n`)}};n();return{reload:n,unload:()=>{t.removeStyle("customControlBackgroundStyle");const o=document.getElementById("control-background-non-touch");o&&o.remove()}}})();
(()=>(o,t)=>{addSettingsListener("customControlBackgroundOpacity",(o=>{document.documentElement.style.setProperty("--custom-control-background-opacity",o)}),true);const n=()=>{t.applyStyle("customControlBackgroundStyle");if(!o.touchVideoPlayer){t.applyImportantStyleFromText(`\n .bilibili-player-video-control-bottom\n {\n margin: 7px 0 0 0 !important;\n padding: 8px 0 0 !important;\n }\n`,"control-background-non-touch")}};n();return{reload:n,unload:()=>{t.removeStyle("customControlBackgroundStyle");const o=document.getElementById("control-background-non-touch");o&&o.remove()}}})();

View File

@ -1 +1 @@
(()=>(n,e)=>{const t="haruna-scale";const a=()=>{if(document.getElementById(t)===null){e.applyStyleFromText(`\n .haruna-ctnr,\n .avatar-btn\n {\n transform: scale(${1/window.devicePixelRatio}) !important;\n }\n`,t)}};a();return{reload:a,unload:()=>{const n=document.getElementById(t);n&&n.remove()}}})();
(()=>(n,t)=>{const a="haruna-scale";const r=`\n .haruna-ctnr,\n .avatar-btn\n {\n transform: scale(${1/window.devicePixelRatio}) !important;\n }\n`.trim();return t.toggleStyle(r,a)})();

View File

@ -1 +1 @@
(()=>(e,l)=>{const t="hideBannerStyle";l.applyStyle(t);return{reload:()=>l.applyStyle(t),unload:()=>l.removeStyle(t)}})();
(()=>(e,l)=>l.toggleStyle("hideBannerStyle"))();

View File

@ -1 +1 @@
(()=>(e,t)=>{addSettingsListener("hideRelatedVideos",(async e=>{const{fillWithComments:i}=await t.importAsync("fill-with-comments");i(e)}),true);return t.toggleStyle(`\n #live_recommand_report, #live_recommend_report { display: none !important; }\n`,`hide-recommend-live-style`)})();
(()=>(e,n)=>n.toggleStyle(`\n #live_recommand_report, #live_recommend_report { display: none !important; }\n`,`hide-recommend-live-style`))();

View File

@ -1 +1 @@
(()=>(i,n)=>{addSettingsListener("hideRecommendLive",(async i=>{const{fillWithComments:e}=await n.importAsync("fill-with-comments");e(i)}),true);return n.toggleStyle(`\n #recom_module,#reco_list,.bilibili-player-ending-panel-box-videos {\n display: none !important;\n }\n .bilibili-player-ending-panel-box-functions .bilibili-player-upinfo-spans {\n position: static !important;\n }\n .bilibili-player-ending-panel-box {\n display: flex !important;\n justify-content: center !important;\n flex-direction: column !important;\n }\n`,`hide-related-videos-style`)})();
(()=>(i,n)=>n.toggleStyle(`\n #recom_module,#reco_list,.bilibili-player-ending-panel-box-videos {\n display: none !important;\n }\n .bilibili-player-ending-panel-box-functions .bilibili-player-upinfo-spans {\n position: static !important;\n }\n .bilibili-player-ending-panel-box {\n display: flex !important;\n justify-content: center !important;\n flex-direction: column !important;\n }\n`,`hide-related-videos-style`))();

View File

@ -1 +1 @@
(()=>(e,r)=>{const t=[".nav-search-keyword",".search-keyword"];for(const e of t){new SpinQuery((()=>$(e)),(e=>e!==undefined&&e.length>0&&e.attr("placeholder").length>0),(e=>e.attr("placeholder","搜索"))).start()}})();
(()=>(e,t)=>{const l=[".nav-search-keyword",".search-keyword"];l.forEach((e=>{SpinQuery.condition((()=>dq(e)),(e=>e!==null&&e.getAttribute("placeholder")!==null)).then((e=>e===null||e===void 0?void 0:e.setAttribute("placeholder","搜索")))}))})();

View File

@ -1 +1 @@
(()=>(e,l)=>{const i=`<style id="narrow-danmaku-style">\n@media screen and (max-width: 1200px)\n{\n .bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar\n {\n display: flex !important;\n }\n}\n</style>`;l.applyStyleFromText(i);return{reload:()=>l.applyStyleFromText(i),unload:()=>document.getElementById("narrow-danmaku-style").remove()}})();
(()=>(i,l)=>l.toggleStyle(`\n @media screen and (max-width: 1200px)\n {\n .bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar\n {\n display: flex !important;\n }\n }\n`,"narrow-danmaku-style"))();

View File

@ -1 +1 @@
(()=>(i,l)=>{const r=`\n#bilibiliPlayer,\n#bilibili-player.mini-player:before\n{\n box-shadow: 0px 2px 8px 0px var(--theme-color-30) !important;\n}\nbody.dark #bilibiliPlayer,\nbody.dark #bilibili-player.mini-player::before\n{\n box-shadow: 0px 2px 8px 0px var(--theme-color-20) !important;\n}\n`.trim();return l.toggleStyle(r,"player-shadow-style")})();
(()=>(i,l)=>{const r=`\n #bilibiliPlayer,\n #bilibili-player.mini-player:before\n {\n box-shadow: 0px 2px 8px 0px var(--theme-color-30) !important;\n }\n body.dark #bilibiliPlayer,\n body.dark #bilibili-player.mini-player::before\n {\n box-shadow: 0px 2px 8px 0px var(--theme-color-20) !important;\n }\n`.trim();return l.toggleStyle(r,"player-shadow-style")})();

View File

@ -1 +1 @@
(()=>(e,t)=>{const o=`.bilibili-player-video-top { display: none !important; }`;const l="remove-top-mask-style";const n=()=>t.applyStyleFromText(`<style id="${l}">${o}</style>`);const s=()=>{const e=document.getElementById(l);if(e){e.remove()}};n();return{reload:n,unload:s}})();
(()=>(e,i)=>i.toggleStyle(`\n .bilibili-player-video-top { display: none !important; }\n`,"remove-top-mask-style"))();

View File

@ -1 +1 @@
(()=>(e,n)=>{const i="remove-live-watermark";const l=`\n.bilibili-live-player-video-logo\n{\n display: none !important;\n}\n`;return n.toggleStyle(l,i)})();
(()=>(e,n)=>{const i="remove-live-watermark";const l=`\n .bilibili-live-player-video-logo\n {\n display: none !important;\n }\n`.trim();return n.toggleStyle(l,i)})();

View File

@ -1 +1 @@
(()=>(t,e)=>{const o=`.article-holder { user-select: text !important }`;const r="selectable-column-text-style";let l=false;const n=()=>{if(!document.URL.startsWith("https://www.bilibili.com/read/")){return}e.applyStyleFromText(o,r);if(!l){l=true;document.addEventListener("copy",(t=>{t.stopImmediatePropagation()}),{capture:true})}};n();return{reload:n,unload:()=>{document.getElementById(r).remove()}}})();
(()=>(t,e)=>{const o=`.article-holder { user-select: text !important }`;const r="selectable-column-text-style";let l=false;const n=()=>{if(!document.URL.startsWith("https://www.bilibili.com/read/")){return}e.applyStyleFromText(o,r);if(!l){l=true;document.addEventListener("copy",(t=>{t.stopImmediatePropagation()}),{capture:true})}};n();return{reload:n,unload:()=>{var t;(t=document.getElementById(r))===null||t===void 0?void 0:t.remove()}}})();

View File

@ -1 +1 @@
(()=>(e,t)=>{if(document.querySelector(".gui-settings-icon-panel")===null){document.body.insertAdjacentHTML("beforeend",`\n<div class='gui-settings-icon-panel icons-enabled'>\n<div class='gui-settings-widgets' title='附加功能'>\n<i class="icon-widgets"></i>\n</div>\n<div class='gui-settings' title='设置'>\n<i class="icon-settings"></i>\n</div>\n</div>`);dq(".gui-settings").addEventListener("click",(e=>{if(e.shiftKey===false){dqa(".gui-settings-box,.gui-settings-mask").forEach((e=>e.classList.add("opened")))}else{dqa(".bilibili-evolved-about,.gui-settings-mask").forEach((e=>e.classList.add("opened")));const e=dq(".bilibili-evolved-about");if(e){raiseEvent(e,"be:about-load-community")}}}));dq(".gui-settings-widgets").addEventListener("click",(e=>{if(e.shiftKey===false){dqa(".gui-settings-widgets-box,.gui-settings-mask").forEach((e=>e.classList.add("opened")))}else{debugger}}));const e=dq(".gui-settings-icon-panel .gui-settings-widgets>i");const t=dq(".gui-settings-icon-panel .gui-settings>i");let i=false;let s=false;const n=()=>{t.classList.remove("icon-info");t.classList.add("icon-settings");t.parentElement.title="设置";e.classList.remove("icon-time");e.classList.add("icon-widgets");e.parentElement.title="附加功能";i=false;s=false};const d=()=>{t.classList.remove("icon-settings");t.classList.add("icon-info");t.parentElement.title="关于";e.classList.remove("icon-widgets");e.classList.add("icon-time");e.parentElement.title="「ザ・ワールド」";if(!i){document.body.addEventListener("keyup",n,{once:true});i=true}if(!s){window.addEventListener("blur",n,{once:true});s=true}};document.body.addEventListener("keydown",(e=>{if(document.activeElement&&["input","textarea"].includes(document.activeElement.nodeName.toLowerCase())){return}if(e.shiftKey===true){d()}}))}addSettingsListener("sideBarOffset",(e=>{document.documentElement.style.setProperty("--side-bar-offset",e+"vh")}),true)})();
(()=>(e,s)=>{if(document.querySelector(".gui-settings-icon-panel")===null){document.body.insertAdjacentHTML("beforeend",`\n<div class='gui-settings-icon-panel icons-enabled'>\n<div class='gui-settings-widgets' title='附加功能'>\n<i class="icon-widgets"></i>\n</div>\n<div class='gui-settings' title='设置'>\n<i class="icon-settings"></i>\n</div>\n</div>`);dq(".gui-settings").addEventListener("click",(e=>{dqa(".gui-settings-box,.gui-settings-mask").forEach((e=>e.classList.add("opened")))}));dq(".gui-settings-widgets").addEventListener("click",(e=>{if(e.shiftKey===false){dqa(".gui-settings-widgets-box,.gui-settings-mask").forEach((e=>e.classList.add("opened")))}else{debugger}}))}addSettingsListener("sideBarOffset",(e=>{document.documentElement.style.setProperty("--side-bar-offset",e+"vh")}),true)})();

View File

@ -1,45 +0,0 @@
const selectors = [
`a.read-more[href*='t.bilibili.com']`,
`.link-navbar a[href*='t.bilibili.com']`,
`.bili-header-m .nav-menu .nav-con .nav-item [href*='t.bilibili.com']`,
];
const oldUrl = `https://www.bilibili.com/account/dynamic`;
const newUrl = `https://t.bilibili.com/`;
const replaceUrl = () =>
{
for (const selector of selectors)
{
// document.querySelectorAll(selector).forEach(it => it.setAttribute("href", oldUrl));
SpinQuery.any(() => document.querySelectorAll(selector), links => links.forEach(it => it.setAttribute("href", oldUrl)));
}
};
SpinQuery.select(".dynamic-m .wnd_bottom .r-l").then(it =>
{
if (it !== null)
{
Observer.childList(".dynamic-m .wnd_bottom .r-l", replaceUrl);
}
})
replaceUrl();
const isNewTweets = location.host === "t.bilibili.com";
export default {
widget: {
condition: () =>
{
return document.URL.startsWith(newUrl) || document.URL.startsWith(oldUrl);
},
content: /*html*/`
<button class="gui-settings-flat-button" id="old-tweets">
<i class="mdi mdi-24px mdi-swap-horizontal-variant"></i>
<span>${isNewTweets ? "回到旧版" : "转到新版"}</span>
</button>`,
success: () =>
{
const button = document.querySelector("#old-tweets");
button.addEventListener("click", () =>
{
location.assign(isNewTweets ? oldUrl : newUrl);
});
},
}
};

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved (Preview)
// @version 1.11.16
// @version 1.11.17
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
// @author Grant Howard, Coulomb-G
// @copyright 2021, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)

View File

@ -5,9 +5,6 @@ Resource.manifest = {
oldStyle: {
path: 'old.min.css'
},
scrollbarStyle: {
path: 'scrollbar.min.css'
},
darkStyle: {
path: 'dark.min.css',
alwaysPreview: true
@ -23,9 +20,6 @@ Resource.manifest = {
touchPlayerStyle: {
path: 'touch-player.min.css'
},
navbarOverrideStyle: {
path: 'override-navbar.min.css'
},
noBannerStyle: {
path: 'no-banner.min.css'
},
@ -134,17 +128,11 @@ Resource.manifest = {
{
key: 'darkStyleNavBar',
important: true,
condition () {
return !settings.useNewStyle && ($('#banner_link').length === 0 ||
$('#banner_link').length > 0 &&
settings.overrideNavBar &&
!settings.showBanner)
}
condition: () => Boolean(document.querySelector('#banner_link')),
},
{
key: 'darkStyleImportant',
important: true,
condition: () => true
}
],
displayNames: {
@ -152,9 +140,6 @@ Resource.manifest = {
useDarkStyleAsUserStyle: 'UserStyle 模式',
}
},
tweetsStyle: {
path: 'tweets.min.css'
},
hideBanner: {
path: 'hide-banner.min.js',
reloadable: true,
@ -176,7 +161,6 @@ Resource.manifest = {
],
displayNames: {
touchVideoPlayer: '播放器触摸支持',
touchVideoPlayerAnimation: '启用实验性动画效果',
touchVideoPlayerDoubleTapControl: '启用双击控制'
}
},
@ -276,14 +260,6 @@ Resource.manifest = {
removeVideoTopMask: '删除视频标题层'
}
},
blurVideoControl: {
path: 'blur-video-control.min.js',
reloadable: true,
style: 'instant',
displayNames: {
blurVideoControl: '模糊视频控制栏背景'
}
},
darkSchedule: {
path: 'dark-schedule.min.js',
displayNames: {
@ -406,23 +382,6 @@ Resource.manifest = {
expandDescription: '自动展开视频简介'
}
},
defaultDanmakuSettingsStyle: {
path: 'default-danmaku-settings.min.css'
},
useDefaultDanmakuSettings: {
path: 'default-danmaku-settings.min.js',
styles: [
{
key: 'defaultDanmakuSettingsStyle',
condition: () => settings.rememberDanmakuSettings
}
],
displayNames: {
useDefaultDanmakuSettings: '使用默认弹幕设置',
enableDanmaku: '开启弹幕',
rememberDanmakuSettings: '记住弹幕设置'
}
},
skipChargeList: {
path: 'skip-charge-list.min.js',
style: 'instant',
@ -430,33 +389,6 @@ Resource.manifest = {
skipChargeList: '跳过充电鸣谢'
}
},
playerLayout: {
path: 'default-player-layout.min.js',
displayNames: {
playerLayout: '指定播放器布局',
useDefaultPlayerLayout: '指定播放器布局',
defaultPlayerLayout: '视频区布局',
defaultBangumiLayout: '番剧区布局'
},
dropdown: [
{
key: 'defaultPlayerLayout',
items: ['旧版', '新版']
},
{
key: 'defaultBangumiLayout',
items: ['旧版', '新版']
}
]
},
compactLayout: {
path: 'compact-layout.min.js',
reloadable: true,
style: true,
displayNames: {
compactLayout: '首页使用紧凑布局'
}
},
medalHelper: {
path: 'medal-helper.min.js',
html: true,
@ -570,12 +502,6 @@ Resource.manifest = {
simplifyLiveroom: '简化直播间'
}
},
oldTweets: {
path: 'old-tweets.min.js',
displayNames: {
oldTweets: '旧版动态跳转支持'
}
},
customNavbarComponent: {
path: 'custom-navbar-component.min.js',
},
@ -596,13 +522,6 @@ Resource.manifest = {
customNavbarBlur: '背景模糊',
customNavbarBlurOpacity: '模糊层不透明度',
customNavbarGlobalFixed: '全局固定',
allNavbarFill: '填充其他顶栏'
}
},
favoritesRedirect: {
path: 'favorites-redirect.min.js',
displayNames: {
favoritesRedirect: '收藏夹视频重定向'
}
},
outerWatchlater: {
@ -627,13 +546,6 @@ Resource.manifest = {
narrowDanmaku: '强制保留弹幕栏'
}
},
hideOldEntry: {
path: 'hide-old-entry.min.js',
reloadable: true,
displayNames: {
hideOldEntry: '隐藏返回旧版'
}
},
videoScreenshot: {
path: 'screenshot.min.js',
reloadable: true,
@ -685,12 +597,6 @@ Resource.manifest = {
autoSeedsToCoins: '自动运行',
},
},
magicGrid: {
path: 'magic-grid.min.js',
displayNames: {
magicGrid: 'Magic Grid',
},
},
autoDraw: {
path: 'auto-draw.min.js',
displayNames: {
@ -744,19 +650,6 @@ Resource.manifest = {
selectableColumnText: '专栏文字选择',
},
},
watchlaterExpireWarnings: {
path: 'watchlater-expire-warnings.min.js',
displayNames: {
watchlaterExpireWarnings: '稍后再看期限提醒',
},
},
superchatTranslate: {
path: 'superchat-translate.min.js',
style: true,
displayNames: {
superchatTranslate: '醒目留言翻译',
},
},
miniPlayerTouchMove: {
path: 'mini-player-touch-move.min.js',
style: true,

View File

@ -188,7 +188,6 @@ export const settings = {
downloadVideoFormat: 'flv',
downloadVideoDashCodec: 'AVC/H.264',
watchlaterExpireWarningDays: 14,
superchatTranslate: false,
miniPlayerTouchMove: false,
hideBangumiSponsors: false,
hideRecommendLive: false,
@ -212,7 +211,6 @@ export const settings = {
defaultLiveQuality: '原画',
foregroundColorMode: '自动',
preserveEventBanner: false,
about: true,
bvidConvert: true,
fixedSidebars: false,
updateCdn: 'jsDelivr',
@ -258,22 +256,10 @@ export const settings = {
cache: {},
}
const fixedSettings = {
hideCategory: false,
useDefaultLiveQuality: false,
recordLiveDanmaku: false,
useDefaultDanmakuSettings: false,
enableDanmaku: true,
rememberDanmakuSettings: false,
danmakuSettings: {
subtitlesPreserve: false,
smartMask: false,
},
autoContinue: false,
useDefaultVideoQuality: false,
autoPlay: false,
favoritesRedirect: false,
compactLayout: false,
hideOldEntry: false,
guiSettings: true,
viewCover: true,
notifyNewVersion: true,
@ -285,17 +271,7 @@ const fixedSettings = {
downloadAudio: true,
downloadLiveRecords: true,
medalHelper: true,
playerLayout: false,
forceWide: false,
useNewStyle: false,
overrideNavBar: false,
touchVideoPlayerAnimation: false,
allNavbarFill: false,
showDeadVideoTitle: false,
blurVideoControl: false,
oldTweets: false,
customNavbarCompact: false,
watchlaterExpireWarnings: false,
latestVersionLink: 'https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/bilibili-evolved.preview.user.js',
currentVersion: GM.info.script.version,
}

23
src/global.d.ts vendored
View File

@ -181,6 +181,8 @@ declare global {
name: string
}
const unsafeWindow: Window
const offlineData: Record<string, string> | undefined
const onlineData: Record<string, string> | undefined
const UserAgent: string
const EmptyImageUrl: string
interface Window {
@ -305,10 +307,7 @@ declare global {
interface BilibiliEvolvedSettings {
[key: string]: any,
useDarkStyle: boolean,
useNewStyle: boolean,
compactLayout: boolean,
hideBanner: boolean,
overrideNavBar: boolean,
expandDanmakuList: boolean,
expandDanmakuListIgnoreMediaList: boolean,
expandDescription: boolean,
@ -320,7 +319,6 @@ declare global {
darkScheduleStart: string,
darkScheduleEnd: string,
darkSchedule: boolean,
blurVideoControl: boolean,
toast: boolean,
fullTweetsTitle: boolean,
fullPageTitle: boolean,
@ -331,7 +329,6 @@ declare global {
showBlockedAdsTip: boolean,
hideTopSearch: boolean,
touchVideoPlayerDoubleTapControl: boolean,
touchVideoPlayerAnimation: boolean,
customStyleColor: string,
preserveRank: boolean,
blurBackgroundOpacity: number,
@ -340,14 +337,6 @@ declare global {
defaultPlayerMode: string,
useDefaultVideoQuality: boolean,
defaultVideoQuality: string,
useDefaultDanmakuSettings: boolean,
enableDanmaku: boolean,
rememberDanmakuSettings: boolean,
danmakuSettings: {
subtitlesPreserve: boolean,
smartMask: boolean,
},
defaultPlayerLayout: string,
defaultBangumiLayout: string,
useDefaultPlayerLayout: boolean,
skipChargeList: boolean,
@ -356,9 +345,7 @@ declare global {
useCache: boolean,
autoContinue: boolean,
allowJumpContinue: boolean,
autoPlay: boolean,
airborne: boolean,
showDeadVideoTitle: boolean,
deadVideoTitleProvider: '稍后再看' | 'BiliPlus',
useBiliplusRedirect: boolean,
biliplusRedirect: boolean,
@ -371,7 +358,6 @@ declare global {
i18nLanguage: string,
playerFocus: boolean,
playerFocusOffset: number,
oldTweets: boolean,
simplifyLiveroom: boolean,
simplifyLiveroomSettings: {
vip: boolean,
@ -405,9 +391,7 @@ declare global {
customNavbarShowDeadVideos: boolean,
playerShadow: boolean,
narrowDanmaku: boolean,
favoritesRedirect: boolean,
outerWatchlater: boolean,
hideOldEntry: boolean,
hideBangumiReviews: boolean,
videoScreenshot: boolean,
cache: {} | { version: string } | undefined,
@ -419,7 +403,6 @@ declare global {
noMiniVideoAutoplay: boolean,
useDefaultVideoSpeed: boolean,
defaultVideoSpeed: string,
hideCategory: boolean,
foldComment: boolean,
downloadVideoDefaultDanmaku: DanmakuOption,
downloadVideoDefaultSubtitle: SubtitleOption,
@ -457,8 +440,6 @@ declare global {
downloadVideoFormat: 'flv' | 'dash',
downloadVideoDashCodec: DashCodec,
enableDashDownload: boolean,
watchlaterExpireWarnings: boolean,
watchlaterExpireWarningDays: number,
superchatTranslate: boolean,
miniPlayerTouchMove: boolean,
hideBangumiSponsors: boolean,

View File

@ -1,20 +0,0 @@
const id = 'haruna-scale'
const load = () => {
if (document.getElementById(id) === null) {
resources.applyStyleFromText(`
.haruna-ctnr,
.avatar-btn
{
transform: scale(${1 / window.devicePixelRatio}) !important;
}
`, id)
}
}
load()
export default {
reload: load,
unload: () => {
const style = document.getElementById(id)
style && style.remove()
}
}

9
src/live/haruna-scale.ts Normal file
View File

@ -0,0 +1,9 @@
const id = 'haruna-scale'
const style = `
.haruna-ctnr,
.avatar-btn
{
transform: scale(${1 / window.devicePixelRatio}) !important;
}
`.trim()
export default resources.toggleStyle(style, id)

View File

@ -1,8 +1,8 @@
const id = 'remove-live-watermark'
const style = `
.bilibili-live-player-video-logo
{
display: none !important;
}
`
.bilibili-live-player-video-logo
{
display: none !important;
}
`.trim()
export default resources.toggleStyle(style, id)

View File

@ -1,28 +0,0 @@
.video-control-blur-layer
{
width: 100%;
height: 100%;
position: absolute;
-webkit-backdrop-filter: blur(48px);
backdrop-filter: blur(48px);
z-index: -1;
top: 0;
}
.bilibili-player-video-control-mask
{
background: transparent !important;
}
.bilibili-player-video-control-bottom,
.bui-slider .bui-track.bui-track-video-progress .bui-bar-wrap
{
background-color: transparent !important;
}
.bilibili-player-video-control-bottom
{
position: relative;
}
.bilibili-player-area .bilibili-player-video-control-wrap,
.bilibili-player-area .bilibili-player-video-control-bottom
{
transition: none !important;
}

View File

@ -1,29 +0,0 @@
const blur = async () =>
{
const containers = await SpinQuery.count(
".bui-slider .bui-track.bui-track-video-progress,.bilibili-player-video-control-bottom",
2);
containers.forEach(container =>
{
if (!container.classList.contains("video-control-blur-container"))
{
container.classList.add("video-control-blur-container");
container.insertAdjacentHTML("afterbegin", /*html*/`<div class="video-control-blur-layer"></div>`);
}
});
};
resources.applyStyle("blurVideoControlStyle");
Observer.videoChange(blur);
export default {
reload: () =>
{
document.querySelectorAll(".video-control-blur-layer").forEach(it => it.style.display = "block");
resources.applyStyle("blurVideoControlStyle");
},
unload: () =>
{
document.querySelectorAll(".video-control-blur-layer").forEach(it => it.style.display = "none");
resources.removeStyle("blurVideoControlStyle");
},
};

View File

@ -1,6 +0,0 @@
// Style key looks strange as it's a generated key
resources.applyImportantStyle("useCommentStyleStyle");
export default {
reload: () => resources.applyImportantStyle("useCommentStyleStyle"),
unload: () => resources.removeStyle("useCommentStyleStyle"),
}

View File

@ -0,0 +1 @@
export default resources.toggleStyle('useCommentStyleStyle')

View File

@ -1,424 +0,0 @@
.groom-module
{
margin: 0 !important;
width: 192px !important;
height: 120px !important;
}
.primary-menu .nav-menu>li.home>a,
.primary-menu .nav-menu .side-nav .side-link i
{
opacity: 0.4;
}
body.dark .primary-menu .nav-menu>li.home>a,
body.dark .primary-menu .nav-menu .side-nav .side-link i
{
opacity: 1;
}
.bangumi-timing-module .card-timing,
.groom-module
{
-webkit-tap-highlight-color: transparent;
}
.chief-recommend-module .recommend-module,
.nominate-m .video-card-box,
.groom-box-m
{
height: 240px !important;
}
.groom-module .pic,
.groom-module .lazy-img
{
width: 100% !important;
height: 100% !important;
}
.groom-module:hover .pic,
.groom-module:hover .lazy-img
{
filter: blur(8px);
}
.groom-module .card-mark
{
width: calc(100% - 20px) !important;
top: 88px;
padding: 10px !important;
}
.groom-module:hover .card-mark
{
top: 0 !important;
}
.chief-recommend-module .carousel-box,
.chief-recommend-module .carousel-box img
{
height: 240px !important;
width: 480px !important;
}
.nominate-m .carousel-box,
.nominate-m .carousel-box img
{
height: 240px !important;
width: 672px !important;
}
.storey-box .spread-module,
.live-module .storey-box .card-live-module,
.special-module,
.video-item-biref
{
margin: 0 !important;
width: 192px !important;
height: 168px !important;
-webkit-tap-highlight-color: transparent;
}
.special-module
{
height: 192px !important;
}
.special-module .pic .title
{
line-height: unset !important;
height: auto !important;
}
.special-recommend-module .storey-box
{
height: 180px !important;
}
.special-module .user
{
transform: translatey(24px);
}
.spread-module .pic,
.live-module .storey-box .card-live-module .pic,
.special-module .pic-box,
.mod-3 .l-item .l,
.mod-1 .l .spread-module,
.mod-3 .l .spread-module,
.mod-2 .spread-module,
.mod-2 li .l,
.video-item-biref .biref-img
{
width: 192px !important;
height: 120px !important;
}
.mod-2 li .l-item
{
height: auto;
}
.mod-3 .l-item,
.mod-3 li
{
width: 192px !important;
}
.mod-3 .l .spread-module
{
margin: 0 !important;
}
.mod-3 li,
.mod-1 li,
.mod-1 .r,
.mod-2 li .l-item
{
padding: 0 !important;
}
.mod-3 .r .v-info,
.mod-3 .r .up-info,
.mod-3 .r .title
{
padding-top: 4px !important;
margin-top: 0px !important;
}
.mod-2 li .r .v-desc
{
padding: 0 !important;
margin: 10px 0 !important;
}
.spread-module .num,
.live-module .storey-box .card-live-module .num
{
padding-left: 8px;
padding-right: 8px;
bottom: 6px;
}
.spread-module .t,
.live-module .storey-box .card-live-module .t,
.special-module .pic .title,
.video-item-biref .biref-info .biref-title
{
padding-left: 4px;
padding-right: 4px;
padding-top: 4px;
}
.sec-rank .rank-list-wrap .rank-list
{
min-height: 288px;
}
.hot-recom-module
{
height: auto !important;
}
.game-groom-box-m,
.game-groom-box-m .game-groom-m
{
height: 100% !important;
}
.spread-module .pic,
.special-module .pic-box,
.groom-module,
.carousel-box .carousel-module .panel,
.live-module .storey-box .card-live-module .pic,
.card-live-module .pic .mask,
.mod-3 .l-item,
.carousel-wrapper,
.video-item-biref .biref-img,
.game-groom-box-m .game-groom-m,
.rank-item .content .img .cover img,
.article-card .article-cover,
.article-card .article-cover img
{
border-radius: 8px !important;
}
.rank-list .rank-item .ri-num,
.card-timing-module .pic,
.timeline-box .timeline-item .preview,
.timeline-box .timeline-item .preview img,
.article-rank-list .rank-item .ri-num
{
border-radius: 50% !important;
}
.cover-preview-module .cover
{
width: 160px;
transform-origin: left top 0px;
transform: scale(1.3);
}
.bangumi-timing-module .card-timing
{
width: 205px;
}
.card-timing-module .r-text
{
width: 120px;
}
.recommend-module .rec-btn.prev
{
left: 0 !important;
}
.primary-menu
{
display: flex;
align-items: center;
margin: 0;
width: 100%;
}
.primary-menu .nav-menu
{
flex: 1 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
margin-right: 28px;
}
.primary-menu .nav-menu>li .num-wrap span
{
padding: 2.5px;
line-height: unset;
height: auto;
min-width: 30px;
}
.primary-menu .nav-menu>li.home>a,
.primary-menu .nav-menu .side-nav .side-link i.square,
.primary-menu .nav-menu .side-nav .side-link i.zhuanlan,
.primary-menu .nav-menu .side-nav .side-link i.live,
.primary-menu .nav-menu .side-nav .side-link i.blackroom
{
background-size: contain;
background-repeat: no-repeat;
background-position: initial;
}
.primary-menu .nav-menu>li .num-wrap
{
top: 0;
}
.primary-menu .nav-menu>li .num-wrap
{
position: static;
height: auto;
}
.primary-menu .nav-menu li .nav-name
{
line-height: unset;
height: auto;
}
.primary-menu .nav-menu>li:not(.home) .nav-name
{
height: auto;
padding: 0;
}
.nav-gif
{
position: static;
flex: 0 0 auto;
}
.primary-menu .nav-menu li.home>a .nav-name
{
visibility: hidden;
display: block;
position: static;
}
.primary-menu .nav-menu .sub-nav
{
top: 36px;
padding-top: 4px;
}
.main-inner
{
width: 1160px;
}
.rank-item .content .img .cover
{
width: 180px;
height: 110px;
}
.rank-item .content
{
padding: 0 0 0 70px;
height: 110px;
}
.rank-item .content .info
{
padding-top: 8px;
margin-left: 192px;
}
.rank-item .content .info .pts
{
bottom: 50px;
}
@media screen and (min-width: 1300px)
{
.bili-wrapper
{
width: 1248px !important;
}
.cinema-home-wrapper
{
width: 1248px !important;
}
.block-area .block-left
{
width: 960px !important;
}
.timeline-box .timeline-item
{
padding-right: 32px !important;
}
.elevator-module
{
margin-left: 630px !important;
}
.bili-wrapper .l-con
{
width: 988px !important;
}
.bangumi-timing-module .card-timing
{
padding: 36px 30px 0 0;
}
.bangumi-timing-module .card-timing:nth-child(4):nth-child(4)
{
padding-top: 0;
}
.mod-1 li .r
{
width: 750px !important;
}
.mod-2 li .r
{
width: 245px !important;
}
.mod-2 li .r .up-info .v-author, .mod-2 li .r .v-info .v-info-i
{
width: 70px !important;
}
.bangumi-timing-module .headline .bili-tab
{
width: 700px;
display: flex;
justify-content: space-evenly;
}
}
@media screen and (max-width: 1300px)
{
.bili-wrapper
{
width: 1056px !important;
}
.cinema-home-wrapper
{
width: 1056px !important;
}
.block-area .block-left
{
width: 768px !important;
}
.elevator-module
{
margin-left: 540px !important;
}
.bili-wrapper .l-con
{
width: 768px !important;
}
.bangumi-timing-module .card-timing
{
padding: 36px 36px 0 0;
}
#ranking_guochuang
{
width: 260px !important;
transform: translatex(28px);
}
.mod-1 li .r
{
width: 530px !important;
}
.mod-2 li .r
{
width: 160px !important;
}
.mod-2 li .r .up-info .v-author, .mod-2 li .r .v-info .v-info-i
{
width: 50px !important;
}
}
.article-card .article-info
{
width: 304px !important;
}
.article-card .article-cover,
.article-card .article-cover img
{
width: 116px !important;
height: 87px !important;
}
.article-card
{
margin-bottom: 0 !important;
}
.article-card .article-info .data>.view,
.article-card .article-info .data>.comment
{
display: inline-flex !important;
align-items: center !important;
}
.article-card .article-info .data
{
display: flex !important;
align-items: center !important;
}
@media screen and (max-width: 1300px)
{
.article-card .article-info
{
width: 220px !important;
}
}

View File

@ -1,25 +0,0 @@
const suitableSites = [
"https://www.bilibili.com/",
"https://www.bilibili.com/watchlater/#/list",
"https://www.bilibili.com/ranking",
];
if (suitableSites.includes(location.href.replace(location.search, '')))
{
document.body.classList.add("compact");
resources.applyImportantStyle("compactLayoutStyle");
}
export default {
reload: () =>
{
if (suitableSites.includes(location.href.replace(location.search, '')))
{
document.body.classList.add("compact");
resources.applyImportantStyle("compactLayoutStyle");
}
},
unload: () =>
{
document.body.classList.remove("compact");
resources.removeStyle("compactLayoutStyle");
}
}

View File

@ -1,9 +0,0 @@
.bilibili-player-video-control-mask
{
background: transparent !important;
}
.bilibili-player-video-control .bilibili-player-video-control-bottom,
.bilibili-player-video-control .bui-slider .bui-track.bui-track-video-progress .bui-bar-wrap
{
background: rgba(0,0,0,var(--custom-control-background-opacity)) !important;
}

View File

@ -0,0 +1,7 @@
.bilibili-player-video-control-mask {
background: transparent !important;
}
.bilibili-player-video-control .bilibili-player-video-control-bottom,
.bilibili-player-video-control .bui-slider .bui-track.bui-track-video-progress .bui-bar-wrap {
background: rgba(0, 0, 0, var(--custom-control-background-opacity)) !important;
}

View File

@ -4,15 +4,13 @@ addSettingsListener('customControlBackgroundOpacity', value => {
const load = () => {
resources.applyStyle('customControlBackgroundStyle')
if (!settings.touchVideoPlayer) {
resources.applyImportantStyleFromText(/*html*/`
<style id="control-background-non-touch">
.bilibili-player-video-control-bottom
{
margin: 7px 0 0 0 !important;
padding: 8px 0 0 !important;
}
</style>
`)
resources.applyImportantStyleFromText(`
.bilibili-player-video-control-bottom
{
margin: 7px 0 0 0 !important;
padding: 8px 0 0 !important;
}
`, 'control-background-non-touch')
}
}
load()
@ -23,4 +21,4 @@ export default {
const nonTouchStyle = document.getElementById('control-background-non-touch')
nonTouchStyle && nonTouchStyle.remove()
},
}
}

View File

@ -1,25 +0,0 @@
const styleID = 'fill-with-comments-style'
export const fillWithComments = (enable) => {
// if (enable) {
// if (dq('#' + styleID)) {
// return
// }
// resources.applyStyleFromText(`
// .v-wrap { position: relative !important; }
// .v-wrap .l-con { width: 100% !important; }
// .v-wrap .r-con {
// position: absolute !important;
// top: 0 !important;
// right: 0 !important;
// }
// .v-wrap .video-info { margin-right: 400px !important; }
// `, styleID)
// } else {
// dqa('#' + styleID).forEach(it => it.remove())
// }
}
export default {
export: {
fillWithComments,
},
}

View File

@ -1,3 +1,3 @@
export default resources.toggleStyle(`
#review_module { display: none !important; }
`, `hide-bangumi-reviews-style`);
`, `hide-bangumi-reviews-style`)

View File

@ -1,3 +1,3 @@
export default resources.toggleStyle(`
#sponsor_module, #paybar_module { display: none !important; }
`, `hide-bangumi-sponsors-style`);
`, `hide-bangumi-sponsors-style`)

View File

@ -1,18 +0,0 @@
#banner_link,
.z-top-container.has-banner>.header,
.custom-navbar .blur-layer
{
display: none !important;
}
div.blur-bg,
.b-header-mask-wrp .b-header-mask-bg
{
opacity: 0 !important;
}
.international-header .bili-banner,
.international-home .bili-banner
{
visibility: hidden !important;
height: 50px !important;
min-height: unset !important;
}

View File

@ -1,6 +0,0 @@
const key = "hideBannerStyle";
resources.applyStyle(key);
export default {
reload: () => resources.applyStyle(key),
unload: () => resources.removeStyle(key),
};

View File

@ -0,0 +1,15 @@
#banner_link,
.z-top-container.has-banner > .header,
.custom-navbar .blur-layer {
display: none !important;
}
div.blur-bg,
.b-header-mask-wrp .b-header-mask-bg {
opacity: 0 !important;
}
.international-header .bili-banner,
.international-home .bili-banner {
visibility: hidden !important;
height: 50px !important;
min-height: unset !important;
}

View File

@ -0,0 +1 @@
export default resources.toggleStyle('hideBannerStyle')

View File

@ -1,3 +0,0 @@
const style = `#entryOld, .main-container .entry-old, .try-feedback, .try-feedback ~ .contact-help, .elevator .list-box .item.back-old { display: none !important; }`
const id = 'hide-old-entry-style'
export default resources.toggleStyle(style, id)

View File

@ -1,7 +0,0 @@
addSettingsListener('hideRelatedVideos', async value => {
const { fillWithComments } = await import('./fill-with-comments')
fillWithComments(value)
}, true)
export default resources.toggleStyle(`
#live_recommand_report, #live_recommend_report { display: none !important; }
`, `hide-recommend-live-style`);

View File

@ -0,0 +1,3 @@
export default resources.toggleStyle(`
#live_recommand_report, #live_recommend_report { display: none !important; }
`, `hide-recommend-live-style`)

View File

@ -1,7 +1,3 @@
addSettingsListener('hideRecommendLive', async value => {
const { fillWithComments } = await import('./fill-with-comments')
fillWithComments(value)
}, true)
export default resources.toggleStyle(`
#recom_module,#reco_list,.bilibili-player-ending-panel-box-videos {
display: none !important;
@ -14,4 +10,4 @@ export default resources.toggleStyle(`
justify-content: center !important;
flex-direction: column !important;
}
`, `hide-related-videos-style`);
`, `hide-related-videos-style`)

View File

@ -1,14 +0,0 @@
const style = `<style id="narrow-danmaku-style">
@media screen and (max-width: 1200px)
{
.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar
{
display: flex !important;
}
}
</style>`;
resources.applyStyleFromText(style);
export default {
reload: () => resources.applyStyleFromText(style),
unload: () => document.getElementById("narrow-danmaku-style").remove(),
};

View File

@ -0,0 +1,9 @@
export default resources.toggleStyle(`
@media screen and (max-width: 1200px)
{
.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar
{
display: flex !important;
}
}
`, 'narrow-danmaku-style')

View File

@ -1,83 +0,0 @@
if (document.URL === `https://h.bilibili.com/`)
{
return;
}
if (document.querySelector(`.z_header`) !== null)
{
resources.removeStyle("tweetsStyle");
return;
}
SpinQuery.any(
() => $(".custom-scrollbar"),
it => it.removeClass("custom-scrollbar")
);
SpinQuery.any(
() => $("#banner_link"),
() => resources.removeStyle("tweetsStyle"),
);
// const newStyles = {
// selectors: [
// "div.nav-con.fl",
// "#link-navbar-vm",
// ".link-navbar",
// ".nav-header-wrapper",
// ".z_top .z_header",
// ".stardust-video .nav-menu"
// ],
// get allSelectors()
// {
// return this.selectors.reduce((acc, s) => acc + "," + s);
// },
// get navbar()
// {
// let result = null;
// for (const selector of this.selectors)
// {
// result = result || document.querySelector(selector);
// }
// return result;
// },
// supports(navbar)
// {
// if (navbar instanceof Element)
// {
// const height = parseInt(window.getComputedStyle(navbar).height);
// const supportHeights = [
// 60, /* show */
// 50, /* stardust player */
// 0, /* live room */
// 56 /* photos */
// ];
// return supportHeights.indexOf(height) !== -1;
// }
// return false;
// }
// };
// SpinQuery.any(() => $(newStyles.allSelectors), () =>
// {
// const navbar = newStyles.navbar;
// if (newStyles.supports(navbar))
// {
// resources.applyStyle("style", "bilibili-style-optimization");
// }
// else
// {
// resources.applyStyle("oldStyle", "bilibili-style-optimization");
// }
// });
if ([
"/h.bilibili.com",
"/live.bilibili.com",
"/link.bilibili.com"
].some(it => document.URL.includes(it)))
{
resources.applyStyle("style", "bilibili-style-optimization");
}
else
{
Promise.race([
SpinQuery.select(() => document.querySelector(".bili-header-m"))
.then(header => header !== null && header.classList.contains("stardust-video")),
SpinQuery.select(() => document.querySelector("body>#Header")).then(header => header !== null)
]).then(supportsNewStyle => resources.applyStyle(supportsNewStyle ? "style" : "oldStyle", "bilibili-style-optimization"));
}

View File

@ -1,218 +0,0 @@
.bili-header-m>.nav-menu,
.b-header-mask-wrp .b-header-mask
{
background: var(--theme-color) !important;
box-shadow: var(--theme-color-70) 0px 2px 10px 1px !important;
}
body .bili-header-m .nav-menu div.nav-mask,
.b-header-mask-wrp,
.z_top
{
background-color: transparent !important;
box-shadow: none !important;
}
.b-header-mask-wrp
{
overflow: unset !important;
}
.bili-header-m .nav-menu .nav-con .nav-item .t,
.z_top.b-header-blur .z_top_nav li:not(.home) a.i-link
{
color: var(--foreground-color-d) !important;
}
li.nav-item:not(.profile-info):hover,
.z_top .z_top_nav ul li:hover,
.uns_box ul.menu li:not(.b-post):hover
{
background-color: hsla(0,0%,var(--brightness),.2) !important;
}
.vip-m
{
background: white !important;
}
a.t>i.bili-icon
{
filter: brightness(0) var(--invert-filter) !important;
background-image: url(https://www.bilibili.com/favicon.ico) !important;
background-size: cover !important;
background-position: inherit !important;
width: 16px !important;
height: 16px !important;
opacity: 0.81 !important;
}
.header-icon-bilibili-tv
{
filter: brightness(0) var(--invert-filter) !important;
opacity: 0.81;
transform: scale(0.9);
}
.z_top .z_top_nav ul li.home
{
filter: brightness(0) invert(1) !important;
background: url(https://www.bilibili.com/favicon.ico) no-repeat left center !important;
opacity: 0.81 !important;
background-size: 16px !important;
background-position-x: 16% !important;
}
#entryOld,
.nav-search-submit,
.b-icon-app,
.title-icon,
.z_top .z_top_nav li .new,
.z_top .z_top_nav li .beta,
.uns_box li.u-i.b-post .up-new,
body>#Header
{
display: none !important;
}
.i-face>.face,
.uns_box li.u-i .i_face
{
box-shadow: 0 0 2px 1.5px #0002 !important;
/* margin-top: -1px !important; */
}
div.up-load
{
margin: 5px 0 0 5px !important;
height: 32px !important;
}
.u-link,
.uns_box li.u-i.b-post a.i-link
{
background: transparent !important;
color: var(--foreground-color-d) !important;
border-radius: 4px !important;
line-height: 30px !important;
height: 30px !important;
border: 1px solid var(--foreground-color-b) !important;
transition: background-color .2s !important;
}
.u-link:hover,
.uns_box li.u-i.b-post a.i-link:hover
{
opacity: 1 !important;
background-color: hsla(0,0%,var(--brightness),.2) !important;
}
.uns_box li.u-i.b-post
{
margin-left: 8px !important;
}
.nav-search
{
width: 140px !important;
}
.nav-search-keyword
{
width: 130px !important;
margin-right: 32px !important;
}
#nav_searchform
{
border-radius: 4px !important;
background: #fffb !important;
border: none !important;
transition: background-color .2s !important;
box-shadow: 0px 2px 10px 1px #0002;
}
#nav_searchform:hover
{
background-color: #fff !important;
}
.nav-search-submit
{
top: 2px !important;
}
.showSearch .nav-search-submit
{
top: 4px !important;
}
#bilibiliPlayer
{
box-shadow: 0px 4px 16px 0px var(--theme-color-40) !important;
}
.blur-bg
{
opacity: var(--blur-background-opacity) !important;
filter: blur(20px) !important;
}
.suggest-item .cancel
{
width: 28px !important;
}
ul.bilibili-suggest
{
margin-left: -30px !important;
width: 200px !important;
}
li.suggest-item>a
{
max-width: 155px !important;
}
.nav-item div.num
{
box-shadow: 0 0.5px 4px 0 #0004 !important;
}
#primary_menu,
#primary_menu>ul.nav-menu,
.uns_box li.u-i.b-post
{
display: flex !important;
align-items: center !important;
}
div.nav-gif,
#primary_menu
{
padding: 0 !important;
}
.up-nav
{
top: 37px !important;
}
.filter-item.search,
body
{
margin: 0 !important;
}
.input-box textarea
{
padding: 8px !important;
}
.bili-header-m .nav-search .nav-search-keyword
{
color: #222 !important;
}
.tag-container .tag-item .tag-border .tag-border-inner
{
width: 100% !important;
}
input.nav-search-keyword::placeholder,
.search-module .search-block input::placeholder
{
color: #888 !important;
}
#home_noob.guide-box
{
display: flex !important;
}
@media only screen and (min-width: 1291px)
{
.bilibili-suggest.nav,
.nav-search
{
width: 250px !important;
/* margin-right: 72px !important; */
}
.nav-search-keyword
{
width: 240px !important;
}
ul.bilibili-suggest
{
margin-left: 0px !important;
width: 250px !important;
}
li.suggest-item>a
{
max-width: 205px !important;
}
}

View File

@ -1,431 +0,0 @@
.bili-wrapper
{
display: flex !important;
justify-content: center !important;
align-items: center !important;
height: 50px !important;
}
.bili-header-m>.nav-menu,
.link-navbar-ctnr .link-navbar,
.link-navbar-ctnr .link-navbar .main-ctnr .nav-items-ctnr,
.link-navbar,
.link-navbar .main-ctnr .nav-items-ctnr,
.nav-header-wrapper
{
background: var(--theme-color) !important;
}
.bili-header-m>.nav-menu,
.nav-header-wrapper,
.link-navbar-ctnr
{
box-shadow: var(--theme-color-70) 0px 2px 10px 1px !important;
}
div.stardust-player
{
background: #fff !important;
}
/*div.player
{
width: 835.5px !important;
}*/
.nav-mask,
.nav-header-wrapper>.nav-header
{
background-color: transparent !important;
}
.nav-mask,
.link-navbar
{
box-shadow: none !important;
}
.nav-con
{
flex-grow: 10 !important;
flex-shrink: 0 !important;
}
.nav-con.fl
{
margin-left: -2em !important;
}
.nav-search-box
{
margin: 9px 0 0 0 !important;
}
.bili-header-m .nav-menu .nav-con .nav-item .t,
.link-navbar .main-ctnr .nav-logo,
.link-navbar .nav-item,
.shortcuts-ctnr,
.shortcuts-ctnr .shortcut-item,
.link-navbar .nav-item:hover,
.link-navbar .main-ctnr .nav-switcher,
.my-link-btn,
.link-navbar .nav-item.selected .label,
.link-navbar .nav-item .icon-font,
.nav-header-wrapper .nav-header .nav-header-mainsite,
.nav-header-wrapper .nav-header .order-center,
.link-navbar .main-ctnr .custom-link>a,
.stardust-video .nav-menu .nav-con .nav-item.home .drop,
.stardust-video .nav-menu .nav-con .nav-item.home .header-icon-Navbar_logo
{
color: var(--foreground-color-d) !important;
}
.stardust-video .nav-menu .nav-con .nav-item.home .header-icon-Navbar_logo
{
transform: scale(0.75) !important;
top: 7px !important;
}
.stardust-video .nav-menu .up-load .up-nav
{
top: 42px !important;
}
li.nav-item:not(.profile-info):hover,
.link-navbar .nav-item:hover,
.shortcuts-ctnr .shortcut-item:hover,
.link-navbar-ctnr .link-navbar .nav-item:hover,
.link-navbar-ctnr .shortcuts-ctnr .shortcut-item:hover,
.my-link-btn:hover,
.publish-btn:hover
{
background-color: hsla(0,0%,var(--brightness),.2) !important;
}
li.nav-item.home:hover,
.link-navbar .nav-item:hover .nav-link .label,
.link-navbar .nav-item:hover .nav-link .label,
.shortcuts-ctnr .shortcut-item .label-wrapper .text:hover,
.publish-btn:hover::after,
.my-link-btn .label:hover
{
background: transparent !important;
}
.vip-m
{
background: white !important;
}
a.t>i.bili-icon-logo,
a.t>i.bili-icon
{
width: 50px !important;
left: -60px !important;
top: 0px !important;
height: 50px !important;
background-position-y: 12px !important;
}
a.t>i.bili-icon-logo,
a.t>i.bili-icon,
.main-ctnr .nav-logo:before,
.link-navbar .nav-item:first-child::before,
.nav-header-wrapper .nav-header .nav-header-logo,
.nav-header-wrapper .nav-header .nav-header-tv-icon,
.nav-header-wrapper .nav-header .order-icon
{
filter: brightness(0) var(--invert-filter) !important;
opacity: 0.81 !important;
}
#entryOld,
.nav-search-submit,
.b-icon-app,
.title-icon,
.blp-red-tip::after,
.main-container .entry-old,
body>#Header
{
display: none !important;
}
.bilibili-player-video-inputbar
{
display: flex !important;
}
/*.i-face>.face
{
margin-top: -1px !important;
}*/
.i-face>.face,
.user-panel-ctnr .msg-hinter
{
box-shadow: 0 0 2px 1.5px #0002 !important;
}
div.up-load
{
margin-top: 8px !important;
margin-left: 9px !important;
height: 32px !important;
order: 4 !important;
flex-grow: 0;
flex-shrink: 0;
}
.stardust-video .nav-menu .nav-wrapper
{
padding: 0 5rem !important;
}
.publish-btn
{
height: 40px !important;
line-height: 40px !important;
background: var(--theme-color) !important;
border: 1px solid var(--foreground-color-d) !important;
border-radius: 5px !important;
box-shadow: none !important;
top: calc(50% - 20px) !important;
transition: all 0.2s !important;
}
.publish-panel
{
margin-top: 7px !important;
}
.my-link-btn
{
border-radius: 0 !important;
}
.slot-ctnr a,
.main-ctnr .search-bar-ctnr .search-bar input
{
color: #222 !important;
}
.main-ctnr .search-bar-ctnr .search-bar .placeholder,
.main-ctnr .search-bar-ctnr .search-bar .search-btn
{
color: #878787 !important;
}
.main-ctnr .search-bar-ctnr .search-bar
{
border: none !important;
box-shadow: 0px 2px 10px 1px #0002 !important;
}
.u-link
{
background: transparent !important;
color: var(--foreground-color-d) !important;
border-radius: 4px !important;
line-height: 30px !important;
height: 30px !important;
transition: background-color .2s !important;
}
.u-link,
.shortcuts-ctnr .shortcut-item .hinter,
.shortcuts-ctnr .shortcut-item .num-hinter
{
border: 1px solid var(--foreground-color-b) !important;
}
.u-link:hover
{
opacity: 1 !important;
background-color: hsla(0,0%,var(--brightness),.2) !important;
}
.stardust-video .nav-con .nav-search,
#nav_searchform
{
width: 130px !important;
}
.stardust-video .nav-con .nav-search .nav-search-keyword
{
color: #222 !important;
width: 120px !important;
padding-right: 32px;
}
.stardust-video .nav-con #nav_searchform,
.nav-header-wrapper .nav-header .nav-header-search-bar
{
border-radius: 4px !important;
background: #fffb !important;
border: none !important;
transition: background-color .2s !important;
box-shadow: 0px 2px 10px 1px #0002;
padding-right: 0 !important;
}
.search-bar-ctnr .search-bar
{
background-color: #fffd !important;
transition: all 0.2s !important;
}
/* .bilibili-player-video-control-top
{
transition: all 0.1s !important;
} */
.search-bar-ctnr .search-bar:hover,
.stardust-video .nav-con #nav_searchform:hover,
.nav-header-wrapper .nav-header .nav-header-search-bar:hover,
.search-bar-ctnr .search-bar:focus-within,
.stardust-video .nav-con #nav_searchform:focus-within,
.nav-header-wrapper .nav-header .nav-header-search-bar:focus-within
{
background-color: #fff !important;
}
#bilibiliPlayer
{
box-shadow: 0px 4px 16px 0px var(--theme-color-40) !important;
}
.blur-bg
{
opacity: var(--blur-background-opacity) !important;
filter: blur(20px) !important;
}
.suggest-item .cancel
{
width: 28px !important;
}
.stardust-video .nav-con ul.bilibili-suggest
{
margin-left: -35px !important;
width: 200px !important;
}
li.suggest-item>a
{
max-width: 155px !important;
}
.nav-item div.num
{
box-shadow: 0 0.5px 4px 0 #0004 !important;
}
#primary_menu,
#primary_menu>ul.nav-menu
{
display: flex !important;
align-items: center !important;
}
.bilibili-player-video-btn-quality
{
width: auto !important;
margin: 0 6px !important;
}
/*li.home>a.t,*/
div.nav-gif,
#primary_menu
{
padding: 0 !important;
}
.filter-item.search,
body
{
margin: 0 !important;
}
.input-box textarea
{
padding: 8px !important;
}
.link-navbar .main-ctnr .nav-switcher.open-btn
{
filter: brightness(0) invert(1) !important;
opacity: 0.8 !important;
}
.guard-rank-cntr.open .tip.rank-desc
{
visibility: visible !important;
}
.guard-rank-cntr .rank-cntr .tip
{
visibility: hidden !important;
}
.tag-container .tag-item .tag-border .tag-border-inner
{
width: 100% !important;
}
.bilibili-player-video-control
{
background-color: transparent !important;
}
.video-control-show .bilibili-player-video-control-top,
.mouse-hover .bilibili-player-video-control-top
{
left: 0 !important;
right: 0 !important;
bottom: 32px !important;
}
.bilibili-player-video-control-top
{
left: -12px !important;
right: -12px !important;
bottom: 0px !important;
}
.bilibili-player .bilibili-player-area .bilibili-player-video-control-wrap
{
bottom: 0px !important;
}
.showSearch .nav-search-submit
{
top: 6px !important;
}
.search-bar-ctnr .search-bar input::placeholder,
.search-bar-ctnr .search-bar .search-btn,
.nav-header-wrapper .nav-header .nav-header-search-bar::placeholder
{
color: #888 !important;
}
.card-list .card
{
border: none !important;
border-radius: 4px !important;
}
@media only screen and (min-width: 1291px)
{
.nav-con
{
margin: 0 1em !important;
}
.stardust-video .nav-con .bilibili-suggest.nav,
.stardust-video .nav-con .nav-search,
#nav_searchform
{
width: 250px !important;
}
.stardust-video .nav-con .nav-search .nav-search-keyword
{
width: 240px !important;
}
.stardust-video .nav-con ul.bilibili-suggest
{
margin-left: 0px !important;
width: 250px !important;
}
.stardust-video .nav-con li.suggest-item>a
{
max-width: 205px !important;
}
}
@media screen and (min-width: 750px)
{
.player .bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-top,
.player .bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-top
{
left: -12px !important;
right: -12px !important;
bottom: 0 !important;
}
.mode-fullscreen .bilibili-player-area.video-control-show:not(.disable-original-hover) .bilibili-player-video-control-top,
.mode-fullscreen .bilibili-player-area.mouse-hover:not(.disable-original-hover) .bilibili-player-video-control-top,
.mode-webfullscreen .bilibili-player-area.video-control-show:not(.disable-original-hover) .bilibili-player-video-control-top,
.mode-webfullscreen .bilibili-player-area.mouse-hover:not(.disable-original-hover) .bilibili-player-video-control-top
{
left: 0 !important;
right: 0 !important;
bottom: 42px !important;
}
}

View File

@ -1,86 +0,0 @@
div.nav-menu
{
width: unset !important;
}
body .bili-header-m .nav-menu div.bili-wrapper
{
width: 1018px;
margin: 0 auto !important;
}
.search
{
position: relative !important;
float: right !important;
margin: 26px 24px 5px 0 !important;
width: 130px !important;
height: 30px !important;
background-color: transparent !important;
padding: 0 !important;
}
form.searchform
{
background-color: #fffb !important;
box-shadow: 0px 2px 10px 1px #0002 !important;
height: 30px !important;
}
form.searchform:hover,
form.searchform:focus-within
{
background-color: #fff !important;
}
button.search-submit,
a.link-ranking
{
display: none !important;
}
input.search-keyword
{
width: 110px !important;
height: 30px !important;
padding: 0 10px !important;
}
.preserve-rank
{
display: flex !important;
}
.preserve-rank>a
{
opacity: 0.382;
filter: brightness(0);
display: flex;
align-items: center;
justify-content: center;
transform: scale(0.64);
cursor: pointer;
width: 30px;
transition: all .2s ease-out !important;
flex-shrink: 0;
}
.preserve-rank>a:hover
{
opacity: 0.75;
}
.preserve-rank>input
{
padding-left: 0 !important;
}
@media only screen and (min-width: 1291px)
{
body .bili-header-m .nav-menu div.bili-wrapper
{
width: 1234px !important;
}
.search
{
width: 250px !important;
margin: 26px 24px 5px 0 !important;
}
input.search-keyword
{
width: 230px !important;
}
}

View File

@ -1,58 +0,0 @@
if (document.querySelector(`.z_header`) !== null)
{
resources.removeStyle("tweetsStyle");
return;
}
SpinQuery.any(
() => $(".head-content.bili-wrapper>div.search:not(.filter-item)"),
textBox =>
{
const rightNavbar = $(document.querySelector(".nav-con.fr"));
textBox.detach().insertAfter(rightNavbar);
},
);
if (settings.preserveRank)
{
SpinQuery.select(
() => document.querySelector(".nav-wrapper .searchform,.nav-con #nav_searchform"),
searchForm =>
{
searchForm.classList.add("preserve-rank");
if (!searchForm.querySelector("a.icons-enabled"))
{
searchForm.insertAdjacentHTML("afterbegin", /*html*/`
<a title="排行榜"
class="icons-enabled"
href="https://www.bilibili.com/ranking"
target="_blank">
<i class="icon-rank"></i>
</a>
`);
}
}
);
}
else
{
SpinQuery.select(
() => document.querySelector(".nav-wrapper .searchform,.nav-con #nav_searchform"),
searchForm =>
{
searchForm.classList.remove("preserve-rank");
const rankIcon = searchForm.querySelector("a.icons-enabled");
rankIcon && rankIcon.remove();
}
);
}
SpinQuery.any(
() => $("#banner_link"),
() => resources.removeStyle("tweetsStyle"),
);
if (!settings.showBanner)
{
resources.applyStyle("noBannerStyle");
}
else
{
resources.removeStyle("noBannerStyle");
}

View File

@ -1,13 +1,13 @@
const style = `
#bilibiliPlayer,
#bilibili-player.mini-player:before
{
box-shadow: 0px 2px 8px 0px var(--theme-color-30) !important;
}
body.dark #bilibiliPlayer,
body.dark #bilibili-player.mini-player::before
{
box-shadow: 0px 2px 8px 0px var(--theme-color-20) !important;
}
#bilibiliPlayer,
#bilibili-player.mini-player:before
{
box-shadow: 0px 2px 8px 0px var(--theme-color-30) !important;
}
body.dark #bilibiliPlayer,
body.dark #bilibili-player.mini-player::before
{
box-shadow: 0px 2px 8px 0px var(--theme-color-20) !important;
}
`.trim()
export default resources.toggleStyle(style, 'player-shadow-style')

View File

@ -1,16 +0,0 @@
const style = `.bilibili-player-video-top { display: none !important; }`;
const id = "remove-top-mask-style";
const reload = () => resources.applyStyleFromText(/*html*/`<style id="${id}">${style}</style>`);
const unload = () =>
{
const styleElement = document.getElementById(id);
if (styleElement)
{
styleElement.remove();
}
}
reload();
export default {
reload,
unload,
};

View File

@ -0,0 +1,3 @@
export default resources.toggleStyle(`
.bilibili-player-video-top { display: none !important; }
`, 'remove-top-mask-style')

View File

@ -1,20 +0,0 @@
::-webkit-scrollbar {
width: 5px !important;
height: 5px !important;
}
::-webkit-scrollbar-corner,
::-webkit-scrollbar-track {
background: transparent !important;
}
::-webkit-resizer,
::-webkit-scrollbar-thumb {
background: #aaa;
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: #888;
}
* {
scrollbar-color: #aaa transparent;
scrollbar-width: thin !important;
}

View File

@ -1,47 +0,0 @@
.nav-search-submit
{
display: block !important;
color: var(--foreground-color-d) !important;
transform: translateX(-125px);
-webkit-tap-highlight-color: transparent;
}
.nav-search-submit:hover
{
color: var(--foreground-color) !important;
}
#nav_searchform
{
transition: all .3s ease-out;
box-shadow: none;
width: 0 !important;
padding: 0 !important;
}
.preserve-rank>a
{
opacity: 0 !important;
pointer-events: none;
}
.showSearch .preserve-rank>a
{
opacity: 0.382 !important;
pointer-events: initial;
}
.showSearch #nav_searchform
{
box-shadow: 0px 2px 10px 1px #0002;
width: 250px !important;
}
.showSearch .nav-search-submit,
.showSearch .nav-search-submit:hover
{
color: #888 !important;
transform: none;
}
@media only screen and (max-width: 1291px)
{
.showSearch #nav_searchform
{
width: 140px !important;
}
}

View File

@ -1,128 +0,0 @@
.bilibili-evolved-about {
height: 100%;
width: 450px;
background: white;
color: #000;
position: fixed;
top: 0;
left: 0;
z-index: 100000;
transform: translateX(-101%);
transition: all 0.3s cubic-bezier(0, 0.86, 0.58, 1);
display: flex;
flex-direction: column;
box-shadow: 4px 0px 16px 0px #0000;
user-select: none;
}
.gui-settings-dock-right .bilibili-evolved-about {
right: 0;
left: unset;
transform: translateX(101%);
}
body.dark .bilibili-evolved-about {
background: #222;
color: #eee;
}
.gui-settings-dock-right .bilibili-evolved-about.opened,
.bilibili-evolved-about.opened {
transform: translateX(0);
box-shadow: 4px 0px 16px 0px #0005;
}
.about-header {
padding: 32px;
display: flex;
align-items: center;
justify-content: flex-start;
}
.about-header i {
margin-right: 8px;
display: flex;
}
.about-title {
font-size: 16pt;
}
.about-content {
padding: 16px 36px 0 36px;
margin-bottom: 36px;
display: flex;
flex-direction: column;
overflow: auto;
}
.about-content .name {
font-size: 24pt;
display: none;
align-items: center;
}
.about-content .name svg {
width: 100%;
}
body.dark .about-content .name.dark,
body:not(.dark) .about-content .name.light {
display: flex;
}
.about-content .version {
font-size: 10pt;
font-weight: bold;
opacity: 0.6;
margin-top: 6px;
margin-bottom: 6px;
align-self: center;
}
.about-content .love {
font-size: 10pt;
margin-bottom: 24px;
align-self: center;
}
.about-content .love a {
color: inherit !important;
}
.about-content section {
font-size: 10pt;
margin-top: 16px;
}
.about-content section .title {
display: flex;
justify-content: center;
text-transform: uppercase;
font-weight: bold;
font-size: 13pt;
letter-spacing: 3px;
margin: 8px 0 16px 0;
}
.about-content section a,
.about-content section .supporter {
color: var(--theme-color) !important;
margin-right: 8px;
display: inline-flex;
}
.about-content section .supporter {
user-select: none;
}
.about-content section .supporter:not(:last-child)::after,
.about-content section a:not(:last-child)::after {
content: ",";
}
@keyframes spinner {
to {
transform: translate(-50%, -50%) rotate(360deg);
}
}
.about-content section.participants .fetching {
margin-right: 8px;
position: relative;
display: inline-flex;
}
.about-content section.participants .fetching::before {
content: "Loading...";
/* box-sizing: border-box;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(0deg);
width: 16px;
height: 16px;
border-radius: 50%;
border: 2px solid #8884;
border-top-color: var(--theme-color);
animation: spinner .6s linear infinite; */
}

View File

@ -1,44 +0,0 @@
<div class="bilibili-evolved-about">
<div class="about-header">
<i class="mdi mdi-information-outline mdi-24px"></i>
<span class="about-title">关于</span>
</div>
<div class="about-content">
<p v-if="branch" class="name light" v-html="logoImage"></p>
<p v-if="branch" class="name dark" v-html="logoImageDark"></p>
<p class="version">v{{version}} · {{clientType}}</p>
<p class="love">
<a target="_blank" href="https://github.com/the1812/Bilibili-Evolved/">Made with ❤  </a>
<a target="_blank" href="https://github.com/the1812/Bilibili-Evolved/blob/preview/doc/donate.md">
Buy me a coffee ☕</a></p>
<section class="authors">
<span class="title">Authors</span>
<a class="author" target="_blank" v-for="author of authors" v-bind:href="author.link">{{author.name}}</a>
</section>
<section class="contributors">
<span class="title">Contributors</span>
<a class="contributor" target="_blank" v-for="contributor of contributors"
v-bind:href="contributor.link">{{contributor.name}}</a>
</section>
<section class="supporters">
<a class="title" target="_blank" href="https://github.com/the1812/Bilibili-Evolved/blob/preview/doc/donate.md#历史">View
Supporters</a>
<!-- <span class="supporter" v-for="supporter of supporters">{{supporter}}</span> -->
</section>
<section class="participants">
<span class="title">Community Power</span>
<span class="fetching" v-if="fetching"></span>
<a class="participant" target="_blank" v-for="participant of participants"
v-bind:href="participant.link">{{participant.name}}</a>
</section>
<section class="websites">
<span class="title">Websites</span>
<a class="website" target="_blank" v-for="website of websites" v-bind:href="website.link">{{website.name}}</a>
</section>
<section class="components">
<span class="title">Components</span>
<a class="component" target="_blank" v-for="component of components"
v-bind:href="component.link">{{component.name}}</a>
</section>
</div>
</div>

View File

@ -1,145 +0,0 @@
(async () => {
const html = await import("aboutHtml")
document.body.insertAdjacentHTML('beforeend', html)
dq('.bilibili-evolved-about').addEventListener('be:about-load', () => {
const nameSorter = (a, b) => a.charCodeAt(0) - b.charCodeAt(0)
const userSorter = (a, b) => nameSorter(a.name, b.name)
const clientTypeMatch = GM.info.script.name.match(/Bilibili Evolved \((.*)\)/)
const clientType = clientTypeMatch ? clientTypeMatch[1] : 'Stable'
new Vue({
el: '.bilibili-evolved-about',
data: {
version: settings.currentVersion,
clientType,
logoImage: null,
logoImageDark: null,
branch: null,
authors: [
{
name: 'Grant Howard',
link: 'https://github.com/the1812'
},
{
name: 'Coulomb-G',
link: 'https://github.com/Coulomb-G'
}
],
contributors: [
{
name: 'PleiadeSubaru',
link: 'https://github.com/Etherrrr'
},
{
name: 'Lets-Halloween',
link: 'https://github.com/Lets-Halloween'
},
{
name: 'shugen002',
link: 'https://github.com/shugen002'
},
{
name: 'Joshuaふみひる',
link: ''
},
{
name: 'kdxcxs',
link: 'https://github.com/kdxcxs'
},
{
name: 'JLoeve',
link: 'https://github.com/LonelySteve'
},
].sort(userSorter),
fetching: true,
participants: [],
websites: [
{
name: 'GitHub',
link: 'https://github.com/the1812/Bilibili-Evolved/'
},
{
name: 'Greasy Fork',
link: 'https://greasyfork.org/zh-CN/scripts/373563-bilibili-evolved'
}
],
components: [
{
name: 'Vue.js',
link: 'https://cn.vuejs.org/index.html'
},
{
name: 'Vuex',
link: 'https://vuex.vuejs.org/zh/',
},
{
name: 'JSZip',
link: 'https://stuk.github.io/jszip/'
},
{
name: 'jQuery',
link: 'http://jquery.com/'
},
{
name: 'debounce',
link: 'https://github.com/component/debounce/'
},
{
name: 'Slip.js',
link: 'https://github.com/kornelski/slip'
},
{
name: 'MDI',
link: 'https://materialdesignicons.com'
},
{
name: 'Lodash',
link: 'https://lodash.com/',
},
]
},
mounted () {
// this.init()
dq('.bilibili-evolved-about').addEventListener('be:about-load-community', () => {
this.init()
}, { once: true })
},
methods: {
async getLogos () {
this.logoImage = await Ajax.getText(`https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/bilibili-evolved-wide.svg`)
this.logoImageDark = await Ajax.getText(`https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/bilibili-evolved-wide-dark.svg`)
},
async init () {
this.branch = /Preview|Local/.test(clientType) ? 'preview' : 'master'
this.getLogos()
const allParticipants = new Set()
let issues = []
let page = 1
do {
issues = await Ajax.getJson(`https://api.github.com/repos/the1812/Bilibili-Evolved/issues?state=all&direction=asc&per_page=100&page=${page}`)
.catch(() => {
issues = [{
name: '电波无法到达(´・_・`)',
link: null
}]
})
page++
for (const issue of issues) {
allParticipants.add(issue.user.login)
}
}
while (issues.length > 0)
this.participants = [...allParticipants].map(name => {
return {
name,
link: `https://github.com/${name}`
}
}).filter(({ link }) => {
return !this.authors.some(it => it.link === link) &&
!this.contributors.some(it => it.link === link)
}).sort(userSorter)
this.fetching = false
}
}
})
}, { once: true })
})()

View File

@ -1,21 +0,0 @@
export default {
widget:
{
content: /*html*/`
<button
class="gui-settings-flat-button"
id="clear-cache">
<i class="icon-clear"></i>
<span>清除缓存</span>
</button>`,
condition: () => typeof offlineData === "undefined",
success: () =>
{
$("#clear-cache").on("click", () =>
{
settings.cache = {};
Toast.success("已删除全部缓存.", "清除缓存", 5000);
});
}
},
};

19
src/utils/clear-cache.ts Normal file
View File

@ -0,0 +1,19 @@
export default {
widget:
{
content: /*html*/`
<button
class="gui-settings-flat-button"
id="clear-cache">
<i class="icon-clear"></i>
<span></span>
</button>`,
condition: () => typeof offlineData === 'undefined',
success: () => {
dq('#clear-cache')?.addEventListener('click', () => {
settings.cache = {}
Toast.success('已删除全部缓存.', '清除缓存', 5000)
})
}
},
}

View File

@ -1,83 +0,0 @@
// https://github.com/component/debounce/
/**
* Returns a function, that, as long as it continues to be invoked, will not
* be triggered. The function will be called after it stops being called for
* N milliseconds. If `immediate` is passed, trigger the function on the
* leading edge, instead of the trailing. The function also has a property 'clear'
* that is a function which will clear the timer to prevent previously scheduled executions.
*
* @source underscore.js
* @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
* @param {Function} function to wrap
* @param {Number} timeout in ms (`100`)
* @param {Boolean} whether to execute at the beginning (`false`)
* @api public
*/
export function debounce(func, wait, immediate)
{
var timeout, args, context, timestamp, result;
if (null == wait) wait = 100;
function later()
{
var last = Date.now() - timestamp;
if (last < wait && last >= 0)
{
timeout = setTimeout(later, wait - last);
} else
{
timeout = null;
if (!immediate)
{
result = func.apply(context, args);
context = args = null;
}
}
};
var debounced = function ()
{
context = this;
args = arguments;
timestamp = Date.now();
var callNow = immediate && !timeout;
if (!timeout) timeout = setTimeout(later, wait);
if (callNow)
{
result = func.apply(context, args);
context = args = null;
}
return result;
};
debounced.clear = function ()
{
if (timeout)
{
clearTimeout(timeout);
timeout = null;
}
};
debounced.flush = function ()
{
if (timeout)
{
result = func.apply(context, args);
context = args = null;
clearTimeout(timeout);
timeout = null;
}
};
return debounced;
};
export default {
export: {
debounce,
},
};

View File

@ -1,22 +0,0 @@
function favoritesRedirect()
{
const videoLinks = document.querySelectorAll("li[data-aid]>a");
videoLinks.forEach(link =>
{
const href = link.getAttribute("href");
if (href === null || !href.includes("medialist"))
{
return;
}
const aid = link.parentElement!.getAttribute("data-aid");
link.setAttribute("href", `https://www.bilibili.com/video/av${aid}`);
});
}
(async () =>
{
const spaceApp = await SpinQuery.select("#app>.s-space");
if (spaceApp !== null)
{
Observer.childListSubtree("#app>.s-space", favoritesRedirect);
}
})();

View File

@ -51,14 +51,8 @@
<dropdown indent="1" key="defaultPlayerMode" dependencies="useDefaultPlayerMode"></dropdown>
<checkbox indent="1" key="applyPlayerModeOnPlay" dependencies="useDefaultPlayerMode"></checkbox>
<checkbox indent="1" key="autoLightOff" dependencies="useDefaultPlayerMode"></checkbox>
<!-- <checkbox indent="0" key="useDefaultVideoQuality" dependencies=""></checkbox>
<dropdown indent="1" key="defaultVideoQuality" dependencies="useDefaultVideoQuality"></dropdown> -->
<checkbox indent="0" key="useDefaultVideoSpeed" dependencies=""></checkbox>
<checkbox indent="0" key="extendVideoSpeed" dependencies=""></checkbox>
<!-- <checkbox indent="0" key="useDefaultDanmakuSettings" dependencies=""></checkbox>
<checkbox indent="1" key="enableDanmaku" dependencies="useDefaultDanmakuSettings"></checkbox>
<checkbox indent="1" key="rememberDanmakuSettings" dependencies="useDefaultDanmakuSettings enableDanmaku">
</checkbox> -->
<checkbox indent="0" key="expandDanmakuList" dependencies=""></checkbox>
<checkbox indent="1" key="expandDanmakuListIgnoreMediaList" dependencies="expandDanmakuList"></checkbox>
<checkbox indent="0" key="expandDescription" dependencies=""></checkbox>

View File

@ -9,15 +9,7 @@ if (document.querySelector('.gui-settings-icon-panel') === null) {
</div>
</div>`)
dq('.gui-settings').addEventListener('click', e => {
if (e.shiftKey === false) {
dqa('.gui-settings-box,.gui-settings-mask').forEach(it => it.classList.add('opened'))
} else {
dqa('.bilibili-evolved-about,.gui-settings-mask').forEach(it => it.classList.add('opened'))
const aboutPanel = dq('.bilibili-evolved-about')
if (aboutPanel) {
raiseEvent(aboutPanel, 'be:about-load-community')
}
}
dqa('.gui-settings-box,.gui-settings-mask').forEach(it => it.classList.add('opened'))
})
dq('.gui-settings-widgets').addEventListener('click', e => {
if (e.shiftKey === false) {
@ -26,47 +18,7 @@ if (document.querySelector('.gui-settings-icon-panel') === null) {
debugger
}
})
const widgetsIcon = dq('.gui-settings-icon-panel .gui-settings-widgets>i')
const settingsIcon = dq('.gui-settings-icon-panel .gui-settings>i')
let keyup = false
let blur = false
const restoreIcon = () => {
settingsIcon.classList.remove('icon-info')
settingsIcon.classList.add('icon-settings')
settingsIcon.parentElement.title = '设置'
widgetsIcon.classList.remove('icon-time')
widgetsIcon.classList.add('icon-widgets')
widgetsIcon.parentElement.title = '附加功能'
keyup = false
blur = false
}
const changeIcon = () => {
settingsIcon.classList.remove('icon-settings')
settingsIcon.classList.add('icon-info')
settingsIcon.parentElement.title = '关于'
widgetsIcon.classList.remove('icon-widgets')
widgetsIcon.classList.add('icon-time')
widgetsIcon.parentElement.title = '「ザ・ワールド」'
if (!keyup) {
document.body.addEventListener('keyup', restoreIcon, { once: true })
keyup = true
}
if (!blur) {
window.addEventListener('blur', restoreIcon, { once: true })
blur = true
}
}
document.body.addEventListener('keydown', e => {
if (document.activeElement &&
["input", "textarea"].includes(document.activeElement.nodeName.toLowerCase())) {
return
}
if (e.shiftKey === true) {
changeIcon()
}
})
}
addSettingsListener("sideBarOffset", value => {
document.documentElement.style.setProperty("--side-bar-offset", value + "vh")
}, true)
}, true)

View File

@ -1,12 +0,0 @@
const selectors = [
".nav-search-keyword",
".search-keyword"
];
for (const selector of selectors)
{
new SpinQuery(
() => $(selector),
it => it !== undefined && it.length > 0 && it.attr("placeholder").length > 0,
textBox => textBox.attr("placeholder", "搜索")
).start();
}

View File

@ -0,0 +1,10 @@
const selectors = [
'.nav-search-keyword',
'.search-keyword'
]
selectors.forEach(selector => {
SpinQuery.condition(
() => dq(selector),
it => it !== null && it.getAttribute('placeholder') !== null,
).then(it => it?.setAttribute('placeholder', '搜索'))
})

View File

@ -1,317 +0,0 @@
可能会查询直播间是否能够使用SuperChat, 顺带返回当前挂在上面的留言
https://api.live.bilibili.com/av/v1/SuperChat/enable?room_id=21547895&jpn=1
```json
{
"code": 0,
"msg": "ok",
"message": "ok",
"data": {
"status": 0,
"jump_url": "https://live.bilibili.com/p/html/live-app-superchat/index.html?is_live_half_webview=1&hybrid_biz=superchat&hybrid_half_ui=1,3,100p,320,0,0,30,100;2,2,375,100p,2d2d2d,0,30,100;3,3,100p,320,2d2d2d,0,30,100;4,2,375,100p,2d2d2d,0,30,100;5,3,100p,420,2d2d2d,0,30,100;6,3,100p,420,0,0,30,100;7,3,100p,420,2d2d2d,0,30,100",
"icon": "https://i0.hdslb.com/bfs/live/0a9ebd72c76e9cbede9547386dd453475d4af6fe.png",
"message_list": [
{
"id": 2551,
"uid": 0,
"background_image": "https://i0.hdslb.com/bfs/live/1aee2d5e9e8f03eed462a7b4bbfd0a7128bbc8b1.png",
"background_color": "#EDF5FF",
"background_icon": "",
"background_bottom_color": "#2A60B2",
"background_price_color": "#7497CD",
"font_color": "",
"price": 30,
"rate": 1000,
"time": 56,
"start_time": 1569678362,
"end_time": 1569678422,
"message": "花丸太可爱了",
"message_jpn": "",
"ts": 1569678366,
"token": "B04FC859",
"user_info": {
"uname": "",
"face": "",
"face_frame": "",
"guard_level": 0,
"user_level": 5,
"is_vip": 0,
"is_svip": 0,
"is_main_vip": 0
}
},
{
"id": 2550,
"uid": 0,
"background_image": "https://i0.hdslb.com/bfs/live/1aee2d5e9e8f03eed462a7b4bbfd0a7128bbc8b1.png",
"background_color": "#EDF5FF",
"background_icon": "",
"background_bottom_color": "#2A60B2",
"background_price_color": "#7497CD",
"font_color": "",
"price": 30,
"rate": 1000,
"time": 21,
"start_time": 1569678327,
"end_time": 1569678387,
"message": "こんばんは",
"message_jpn": "",
"ts": 1569678366,
"token": "CA2C647F",
"user_info": {
"uname": "",
"face": "",
"face_frame": "",
"guard_level": 0,
"user_level": 20,
"is_vip": 0,
"is_svip": 0,
"is_main_vip": 1
}
},
{
"id": 2548,
"uid": 0,
"background_image": "https://i0.hdslb.com/bfs/live/1aee2d5e9e8f03eed462a7b4bbfd0a7128bbc8b1.png",
"background_color": "#F2FFFE",
"background_icon": "",
"background_bottom_color": "#427D9E",
"background_price_color": "#7DA4BD",
"font_color": "",
"price": 50,
"rate": 1000,
"time": 13,
"start_time": 1569678259,
"end_time": 1569678379,
"message": "花丸ハ花丸ハ花丸ハ花丸/花丸/",
"message_jpn": "",
"ts": 1569678366,
"token": "5A52512F",
"user_info": {
"uname": "",
"face": "",
"face_frame": "",
"guard_level": 0,
"user_level": 17,
"is_vip": 0,
"is_svip": 0,
"is_main_vip": 1
}
}
]
}
}
```
仅查询留言列表
https://api.live.bilibili.com/av/v1/SuperChat/getMessageList?room_id=21547895&jpn=1
```json
{
"code": 0,
"msg": "success",
"message": "success",
"data": {
"list": [
{
"id": 2566,
"uid": 0,
"background_image": "https://i0.hdslb.com/bfs/live/1aee2d5e9e8f03eed462a7b4bbfd0a7128bbc8b1.png",
"background_color": "#FFF4FB",
"background_icon": "",
"background_bottom_color": "#86105D",
"background_price_color": "#AD5990",
"font_color": "",
"price": 100,
"rate": 1000,
"time": 232,
"start_time": 1569679412,
"end_time": 1569679712,
"message": "花丸世界一かわいい!!!!!",
"message_jpn": "",
"ts": 1569679480,
"token": "3F73C13",
"user_info": {
"uname": "",
"face": "",
"face_frame": "",
"guard_level": 0,
"user_level": 9,
"is_vip": 0,
"is_svip": 0,
"is_main_vip": 0
}
}
]
}
}
```
留言详细信息(稳定日语翻译)
https://api.live.bilibili.com/av/v1/SuperChat/messageInfo?id=2626
```json
{
"code": 0,
"msg": "",
"message": "",
"data": {
"id": "2626",
"uid": "0",
"background_image": "https://i0.hdslb.com/bfs/live/1aee2d5e9e8f03eed462a7b4bbfd0a7128bbc8b1.png",
"background_color": "#FFF2E3",
"background_icon": "https://i0.hdslb.com/bfs/live/e12e931ed8d9e5189ab6d1a3a1da35af4f8a55af.png",
"background_bottom_color": "#E09443",
"background_price_color": "#E8AF79",
"font_color": "",
"price": 514,
"rate": 1000,
"time": 788,
"start_time": 1569684426,
"end_time": 1569686226,
"message": "114514",
"message_jpn": "114514",
"ts": 1569685438,
"token": "1BDF9EF2",
"user_info": {
"uname": "",
"face": "",
"face_frame": "",
"guard_level": 0,
"user_level": 12,
"level_color": "#61c05a",
"is_vip": 0,
"is_svip": 0,
"is_main_vip": 1,
"title": "0",
"manager": 0
},
"medal_info": {
"target_id": 349991143,
"medal_level": 5,
"medal_name": "財布",
"medal_color": "#5896de"
}
}
}
```
这个不知道干什么用的
https://api.live.bilibili.com/av/v1/SuperChat/ownMessageList?room_id=21547895
----
留言内容结构
```js
{
// 醒目留言ID
"id": 2551,
// 用户ID
"uid": 0,
// 样式也写在api中可还行
"background_image": "https://i0.hdslb.com/bfs/live/1aee2d5e9e8f03eed462a7b4bbfd0a7128bbc8b1.png",
"background_color": "#EDF5FF",
"background_icon": "",
"background_bottom_color": "#2A60B2",
"background_price_color": "#7497CD",
"font_color": "",
// 钞能力等级(
"price": 30,
// 这个不知道是什么 可能是RMB与金瓜子的倍率?
"rate": 1000,
// 剩余时间
"time": 56,
// 开始时间
"start_time": 1569678362,
// 结束时间
"end_time": 1569678422,
"message": "花丸太可爱了",
// (机翻)日语文本
"message_jpn": "",
"ts": 1569678366,
"token": "B04FC859",
"user_info": {
"uname": "",
"face": "",
"face_frame": "",
"guard_level": 0,
"user_level": 5,
"is_vip": 0,
"is_svip": 0,
"is_main_vip": 0
}
}
```
HTML结构
```html
<div data-v-d9f0951e="" class="detail-info">
<div data-v-d9f0951e="" class="mask"></div>
<div data-v-d08fa08e="" data-v-d9f0951e="" class="card-detail">
<div data-v-d08fa08e="" class="card-item-middle-top"
style="border: 1px solid rgb(187, 11, 48); background-image: url(&quot;https://i0.hdslb.com/bfs/live/1aee2d5e9e8f03eed462a7b4bbfd0a7128bbc8b1.png&quot;); background-color: rgb(255, 236, 234);">
<div data-v-d08fa08e="" class="card-item-middle-top-left">
<div data-v-d08fa08e="" class="icon-face"
style="background-image: url(&quot;https://i2.hdslb.com/bfs/face/9b6310bae3e76914376e2abc8d9e71cce8c85a44.jpg&quot;);">
</div>
<!---->
</div>
<div data-v-d08fa08e="" class="card-item-middle-top-right">
<div data-v-d08fa08e="" class="name isVip">uname</div>
<div data-v-d08fa08e="" class="content-bottom">
<div data-v-d08fa08e="" class="price">¥1000<span data-v-d08fa08e="" class="exp">100万金瓜子</span></div>
<!---->
</div>
</div>
</div>
<div data-v-d08fa08e="" class="card-item-middle-bottom" style="background-color: rgb(187, 11, 48);">
<div data-v-d08fa08e="" class="input-contain"><span data-v-d08fa08e=""
class="text">encoreencoreencore</span></div>
<div data-v-d08fa08e="" class="bottom-background"
style="background-image: url(&quot;https://i0.hdslb.com/bfs/live/0cf7b5fdc7084c9ae05f7a371ea2438118529d66.png&quot;);">
</div>
</div>
<div data-v-d08fa08e="" class="more"></div>
<!---->
</div>
</div>
<div class="chat-item danmaku-item superChat-card-detail" data-uname="" data-uid="" data-ts="1569679816"
data-ct="FF618B15" data-danmaku="いつも可愛くて優しい花丸ちゃんのこと好きになってよかった。">
<div class="card-item-top-right" style="background-color: #AD5990">¥150(15万金瓜子)</div>
<div class="card-item-middle-top"
style="background-image: url(https://i0.hdslb.com/bfs/live/1aee2d5e9e8f03eed462a7b4bbfd0a7128bbc8b1.png); border: 1px solid #86105D; background-color: #FFF4FB">
<div class="card-item-middle-top-left">
<div class="icon-face pointer open-menu"
style="background-image: url(http://i2.hdslb.com/bfs/face/52bf7ba0c2840c939650a7ebae31666304473911.jpg)"></div>
<div class="icon-face-frame pointer open-menu"
style="background-image: url(http://i0.hdslb.com/bfs/live/78e8a800e97403f1137c0c1b5029648c390be390.png)"></div>
</div>
<div class="card-item-middle-top-right pointer">
<div class="name pointer open-menu isVip">uname</div>
<div class="superChat-base guard-danmaku"><a
href="//link.bilibili.com/p/center/index#/user-center/my-info/operation?vip=true" target="_blank"><i
class="vip-icon svg-icon vip-year-color" title="不来当一发老爷么?>ㅂ< "></i></a>
<div class="fans-medal-item-ctnr dp-i-block p-relative v-middle" title="这是 TA 的粉丝勋章 >ㅂ<ノ ☆">
<div class="fans-medal-item level-8 false">
<span class="label">花丸家</span><span class="level">8</span>
<div class="hover-panel a-scale-in-ease">
<a class="out-link" href="/21547895" target="_blank">
<span class="content">勋章主播花丸晴琉Official</span>
</a>
</div>
</div>
</div>
<div class="user-level-icon lv-24 dp-i-block p-relative v-middle" title="这是 TA 的用户等级 <(▰˘◡˘▰)>">UL 24</div>
<div class="title-label dp-i-block p-relative v-middle">
<div class="hover-panel a-scale-in-ease"><span style="color: #000">活动头衔</span><br><a class="out-link"
title="点击查看所有直播头衔 (=・ω・=)" href="//link.bilibili.com/p/center/index#/user-center/wearing-center/library"
target="_blank">查看详情</a></div>
</div>
</div>
</div>
</div>
<div class="card-item-middle-bottom" style="background-color: #86105D">
<div class="input-contain">
<span class="text">いつも可愛くて優しい花丸ちゃんのこと好きになってよかった。</span>
</div>
<div class="bottom-background" style="background-image: url()"></div>
</div>
</div>
```

View File

@ -1,3 +0,0 @@
.chat-history-panel .chat-item.superChat-card-detail .input-contain .text {
display: block !important;
}

View File

@ -1,95 +0,0 @@
(async () => {
if (!document.URL.startsWith('https://live.bilibili.com/')) {
return
}
const roomIDMatch = document.URL.match(/live\.bilibili\.com\/(\d+)/)
if (!roomIDMatch) {
return
}
const roomID = roomIDMatch[1]
const chatList = await SpinQuery.select('.chat-history-list')
if (chatList === null) {
console.warn('chatList not found')
return
}
resources.applyStyle('superchatTranslateStyle')
const getSuperchatMessageList = async () => {
const json = await Ajax.getJson(`https://api.live.bilibili.com/av/v1/SuperChat/getMessageList?room_id=${roomID}&jpn=1`)
if (json.code !== 0) {
console.warn(`getMessageList api failed: ${json.message}`)
return []
}
return _.get(json, 'data.list', [])
}
const getTranslation = (id: number | string): Promise<string> => {
return new Promise(resolve => {
setTimeout(async () => {
const json = await Ajax.getJson(`https://api.live.bilibili.com/av/v1/SuperChat/messageInfo?id=${id}`)
if (json.code !== 0) {
console.warn(`messageInfo api failed: ${json.message}`)
resolve('')
}
resolve(_.get(json, 'data.message_jpn', ''))
}, 3000)
})
}
Observer.childListSubtree('.pay-note-panel', async () => {
console.log('.pay-note-panel')
const textElement = dq('.detail-info .input-contain .text:not(.original):not(.jpn)') as HTMLElement
if (!textElement) {
return
}
const messageList = await getSuperchatMessageList()
const message = messageList.find((m: any) => m.message === textElement.innerText)
if (!message) {
console.warn('message not found')
return
}
const translation = message.message_jpn || await getTranslation(message.id)
textElement.classList.add('original')
const translationElement = document.createElement('span')
translationElement.classList.add('text', 'jpn')
translationElement.style.opacity = '.5'
translationElement.innerText = translation
textElement.insertAdjacentElement('afterend', translationElement)
console.log(`inserted translation: `, {
original: message.message,
translation,
})
})
Observer.childList(chatList, records => {
records.forEach(record => {
record.addedNodes.forEach(async node => {
if (node instanceof HTMLElement && node.classList.contains('superChat-card-detail')) {
const original = node.getAttribute('data-danmaku')
if (!original) {
console.warn('original not found')
return
}
const messageList = await getSuperchatMessageList()
const message = messageList.find((m: any) => m.message === original)
if (!message) {
console.warn('message not found')
return
}
const translation = message.message_jpn || await getTranslation(message.id)
const textElement = await SpinQuery.select(`.superChat-card-detail[data-danmaku='${original}'] .input-contain .text:not(.original):not(.jpn)`)
if (!textElement) {
console.warn('textElement not found')
return
}
textElement.classList.add('original')
const translationElement = document.createElement('span')
translationElement.classList.add('text', 'jpn')
translationElement.style.opacity = '.5'
translationElement.innerText = translation
textElement.insertAdjacentElement('afterend', translationElement)
console.log(`inserted translation: `, {
original: message.message,
translation,
})
}
})
})
})
})()

View File

@ -1,16 +0,0 @@
export interface MagicGridConfig {
container: string | HTMLElement // Required. Can be a class, id, or an HTMLElement
static: boolean // Required for static content. Default: false.
items: number, // Required for dynamic content. Initial number of items in the container.
gutter?: number, // Optional. Space between items. Default: 25(px).
maxColumns?: number, // Optional. Maximum number of columns. Default: Infinite.
useMin?: boolean, // Optional. Prioritize shorter columns when positioning items. Default: false.
useTransform?: boolean, // Optional. Position items using CSS transform. Default: True.
animate?: boolean, // Optional. Animate item positioning. Default: false.
}
export class MagicGrid {
constructor(config: MagicGridConfig)
listen(): void
positionItems(): void
}
export const MagicGridComponent: any

View File

@ -1,442 +0,0 @@
/*
This is an ESM version of Magic Grid, with additional Vue component support.
Modified by Grant Howard
Magic Grid repo: https://github.com/e-oj/Magic-Grid
Vue Magic Grid repo: https://github.com/imlinus/vue-magic-grid
*/
/**
* @author emmanuelolaojo
* @since 11/11/18
*/
/**
* Validates the configuration object.
*
* @param config - configuration object
*/
const checkParams = function (config) {
const DEFAULT_GUTTER = 25
if (!config) {
throw new Error('No config object has been provided.')
}
if (typeof config.useTransform !== 'boolean') {
config.useTransform = true
}
if (typeof config.gutter !== 'number') {
config.gutter = DEFAULT_GUTTER
}
if (!config.container) { error('container') }
if (!config.items && !config.static) { error('items or static') }
}
/**
* Handles invalid configuration object
* errors.
*
* @param prop - a property with a missing value
*/
const error = function (prop) {
throw new Error(("Missing property '" + prop + "' in MagicGrid config"))
}
/**
* Finds the shortest column in
* a column list.
*
* @param cols - list of columns
*
* @return shortest column
*/
const getMin = function (cols) {
let min = cols[0]
for (const col of cols) {
if (col.height < min.height) { min = col }
}
return min
}
/**
* @author emmanuelolaojo
* @since 11/10/18
*
* The MagicGrid class is an
* implementation of a flexible
* grid layout.
*/
export class MagicGrid {
constructor (config) {
checkParams(config)
if (config.container instanceof HTMLElement) {
this.container = config.container
this.containerClass = config.container.className
} else {
this.containerClass = config.container
this.container = document.querySelector(config.container)
}
this.items = this.container.children
this.static = config.static || false
this.size = config.items
this.gutter = config.gutter
this.maxColumns = config.maxColumns || false
this.useMin = config.useMin || false
this.useTransform = config.useTransform
this.animate = config.animate || false
this.started = false
this.init()
}
/**
* Initializes styles
*
* @private
*/
init () {
if (!this.ready() || this.started) { return }
this.container.style.position = 'relative'
for (let i = 0; i < this.items.length; i++) {
const style = this.items[i].style
style.position = 'absolute'
if (this.animate) {
style.transition = (this.useTransform ? 'transform' : 'top, left') + ' 0.2s ease'
}
}
this.started = true
}
/**
* Calculates the width of a column.
*
* @return width of a column in the grid
* @private
*/
colWidth () {
return this.items[0].getBoundingClientRect().width + this.gutter
}
/**
* Initializes an array of empty columns
* and calculates the leftover whitespace.
*
* @return {{cols: Array, wSpace: number}}
* @private
*/
setup () {
const width = this.container.getBoundingClientRect().width
const colWidth = this.colWidth()
let numCols = Math.floor(width / colWidth) || 1
const cols = []
if (this.maxColumns && numCols > this.maxColumns) {
numCols = this.maxColumns
}
for (let i = 0; i < numCols; i++) {
cols[i] = { height: 0, index: i }
}
const wSpace = width - numCols * colWidth + this.gutter
return { cols, wSpace }
}
/**
* Gets the next available column.
*
* @param cols list of columns
* @param i index of dom element
*
* @return {*} next available column
* @private
*/
nextCol (cols, i) {
if (this.useMin) {
return getMin(cols)
}
return cols[i % cols.length]
}
/**
* Positions each item in the grid, based
* on their corresponding column's height
* and index then stretches the container to
* the height of the grid.
*/
positionItems () {
const ref = this.setup()
const cols = ref.cols
let wSpace = ref.wSpace
let maxHeight = 0
const colWidth = this.colWidth()
wSpace = Math.floor(wSpace / 2)
for (let i = 0; i < this.items.length; i++) {
const col = this.nextCol(cols, i)
const item = this.items[i]
const topGutter = col.height ? this.gutter : 0
const left = col.index * colWidth + wSpace + 'px'
const top = col.height + topGutter + 'px'
if (this.useTransform) {
item.style.transform = 'translate(' + left + ', ' + top + ')'
} else {
item.style.top = top
item.style.left = left
}
col.height += item.getBoundingClientRect().height + topGutter
if (col.height > maxHeight) {
maxHeight = col.height
}
}
this.container.style.height = maxHeight + 'px'
}
/**
* Checks if every item has been loaded
* in the dom.
*
* @return {Boolean} true if every item is present
*/
ready () {
if (this.static) { return true }
return this.items.length >= this.size
}
/**
* Periodically checks that all items
* have been loaded in the dom. Calls
* this.listen() once all the items are
* present.
*
* @private
*/
getReady () {
const interval = setInterval(() => {
this.container = document.querySelector(this.containerClass)
this.items = this.container.children
if (this.ready()) {
clearInterval(interval)
this.init()
this.listen()
}
}, 100)
}
/**
* Positions all the items and
* repositions them whenever the
* window size changes.
*/
listen () {
if (this.ready()) {
let timeout
window.addEventListener('resize', () => {
if (!timeout) {
timeout = setTimeout(() => {
this.positionItems()
timeout = null
}, 200)
}
})
this.positionItems()
} else { this.getReady() }
}
}
export const MagicGridComponent = {
template: /*html*/`
<div :class="[wrapper]">
<slot></slot>
</div>
`,
name: 'magic-grid',
props: {
wrapper: {
type: String, // Required. Class or id of the container.
default: 'wrapper'
},
gap: {
type: Number, // Optional. Space between items. Default: 32px
default: 32
},
maxCols: {
type: Number, // Maximum number of colums. Default: Infinite
default: 5
},
maxColWidth: {
type: Number,
default: 280
},
animate: {
type: Boolean, // Animate item positioning. Default: false.
default: true
},
useMin: {
type: Boolean, // Place items in lower column
default: false
}
},
data () {
return {
started: false,
items: []
}
},
mounted () {
this.waitUntilReady()
},
updated () {
this.positionItems()
},
methods: {
waitUntilReady () {
if (this.isReady()) {
this.positionItems()
// window.addEventListener('resize', () => {
// setTimeout(this.positionItems(), 200)
// })
} else this.getReady()
},
isReady () {
return this.$el && this.items.length > 0
},
getReady () {
let interval = setInterval(() => {
this.items = this.$el.children
if (this.isReady()) {
clearInterval(interval)
this.init()
}
}, 100)
},
init () {
if (!this.isReady() || this.started) return
this.$el.style.position = 'relative'
Array.prototype.forEach.call(this.items, item => {
item.style.position = 'absolute'
item.style.maxWidth = this.maxColWidth + 'px'
if (this.animate) item.style.transition = 'top, left 0.2s ease'
})
this.started = true
this.waitUntilReady()
},
colWidth () {
return this.items[0].getBoundingClientRect().width + this.gap
},
setup () {
let width = this.$el.getBoundingClientRect().width
let numCols = Math.floor(width / this.colWidth()) || 1
let cols = []
if (this.maxCols && numCols > this.maxCols) {
numCols = this.maxCols
}
for (let i = 0; i < numCols; i++) {
cols[i] = {
height: 0,
top: 0,
index: i
}
}
let wSpace = width - numCols * this.colWidth() + this.gap
return {
cols,
wSpace
}
},
nextCol (cols, i) {
if (this.useMin) return this.getMin(cols)
return cols[i % cols.length]
},
positionItems () {
let { cols, wSpace } = this.setup()
wSpace = Math.floor(wSpace / 2)
Array.prototype.forEach.call(this.items, (item, i) => {
item.style.position = 'absolute'
item.style.maxWidth = this.maxColWidth + 'px'
if (this.animate) item.style.transition = 'top, left 0.2s ease'
let min = this.nextCol(cols, i)
let left = min.index * this.colWidth() + wSpace
item.style.left = left + 'px'
item.style.top = min.height + min.top + 'px'
min.height += min.top + item.getBoundingClientRect().height
min.top = this.gap
})
this.$el.style.height = this.getMax(cols).height + 'px'
},
getMax (cols) {
let max = cols[0]
for (let col of cols) {
if (col.height > max.height) max = col
}
return max
},
getMin (cols) {
let min = cols[0]
for (let col of cols) {
if (col.height < min.height) min = col
}
return min
}
}
}
export default {
export: {
MagicGrid,
MagicGridComponent,
}
}

View File

@ -1,9 +0,0 @@
// if (document.URL.replace(window.location.search, '') === 'https://t.bilibili.com/') {
// Observer.attributes('.vc-video>.bilibili-link-player', records => {
// records.forEach(record => {
// if (record.attributeName === 'data-playing-state') {
// }
// })
// })
// }

View File

@ -67,4 +67,4 @@ body.dark .blocked.new {
body.compact .blocked {
width: 480px;
height: 240px;
}
}

View File

@ -17,6 +17,6 @@ load()
export default {
reload: load,
unload: () => {
document.getElementById(id).remove()
document.getElementById(id)?.remove()
},
}
}

View File

@ -1,124 +0,0 @@
(async () => {
if (!document.URL.startsWith('https://space.bilibili.com')) {
return
}
interface DeadVideoInfo {
aid: string
title: string
cover: string
}
abstract class DeadVideoInfoProvider {
abstract async queryInfo(aids: string[]): Promise<DeadVideoInfo[]>
}
class BiliplusProvider extends DeadVideoInfoProvider {
static BiliplusHost = `https://hd.biliplus.com`
static MaxCountPerRequest = 30
private convertToDeadVideoInfo(aid: string, raw: { title: string, pic: string }) {
return {
aid,
title: raw.title,
cover: raw.pic,
}
}
async queryInfo(aids: string[]) {
const results: DeadVideoInfo[] = []
if (aids.length <= BiliplusProvider.MaxCountPerRequest) {
const json = await Ajax.getJson(`${BiliplusProvider.BiliplusHost}/api/aidinfo?aid=${aids.join(',')}`)
if (json.code === 0) {
results.push(...aids.map(aid => {
if (aid in json.data) {
return this.convertToDeadVideoInfo(aid, json.data[aid])
} else {
return {
aid,
title: '已失效视频',
cover: '',
}
}
}))
} else {
console.error(`[显示失效视频信息] Biliplus API 未成功. message=${json.message}`)
}
} else {
results.push(...(await this.queryInfo(aids.slice(0, BiliplusProvider.MaxCountPerRequest))))
results.push(...(await this.queryInfo(aids.slice(BiliplusProvider.MaxCountPerRequest))))
}
return results
}
}
class WatchlaterProvider extends DeadVideoInfoProvider {
private async toggleWatchlater(add: boolean, aids: string[]) {
for (const aid of aids) {
await Ajax.postTextWithCredentials(`https://api.bilibili.com/x/v2/history/toview/${add ? 'add' : 'del'}`, `aid=${aid}&csrf=${getCsrf()}}`)
}
}
async queryInfo(aids: string[]) {
const results: DeadVideoInfo[] = []
await this.toggleWatchlater(true, aids)
const json = await Ajax.getJsonWithCredentials('https://api.bilibili.com/x/v2/history/toview/web')
if (json.code === 0) {
const watchlaterList = json.data.list.map((it: any) => {
return {
aid: it.aid.toString(),
title: it.title,
cover: it.pic,
}
}) as DeadVideoInfo[]
results.push(...aids
.map(aid => watchlaterList.find(item => item.aid === aid) as DeadVideoInfo)
.filter(it => it !== undefined))
await this.toggleWatchlater(false, aids)
}
else {
console.error(`[显示失效视频信息] 稍后再看 API 未成功. message=${json.message}`)
}
return results
}
}
const spaceApp = await SpinQuery.select('#app>.s-space')
if (!spaceApp) {
return
}
Observer.childListSubtree(spaceApp, async () => {
const deadVideos = dqa('.disabled[data-aid]')
if (deadVideos.length === 0) {
return
}
const aids = deadVideos.map(it => it.getAttribute('data-aid')!)
const query: DeadVideoInfoProvider =
settings.deadVideoTitleProvider === 'BiliPlus' ? new BiliplusProvider() : new WatchlaterProvider()
const infos = await query.queryInfo(aids)
console.log(`[显示失效视频信息]`, `deadVideos:`, deadVideos, `infos:`, infos)
deadVideos.forEach((it, index) => {
it.classList.remove('disabled')
const aid = it.getAttribute('data-aid')!
const link = (() => {
if (settings.useBiliplusRedirect) {
return `https://hd.biliplus.com/video/av${aid}`
} else {
return `//www.bilibili.com/video/av${aid}`
}
})()
const info = infos.find(it => it.aid === aid)
console.log(`[显示失效视频信息]`, '#' + index, info)
if (info === undefined) {
console.error(`[显示失效视频信息]信息获取失败, aid=${aid}`)
return
}
const coverLink = it.querySelector('a.cover') as HTMLAnchorElement
coverLink.target = '_blank'
coverLink.href = link
if (info.cover !== '') {
coverLink.querySelector('img')!.src = info.cover.replace('http:', 'https:')
}
const titleLink = it.querySelector('a.title') as HTMLAnchorElement
titleLink.target = '_blank'
titleLink.title = info.title
titleLink.href = link
titleLink.innerText = info.title
})
})
})()

View File

@ -1,48 +0,0 @@
(async () => {
if (!['//www.bilibili.com/watchlater/#/list'].some(it => document.URL.includes(it))) {
return
}
const { getWatchlaterList } = await import('../video/watchlater-api')
const listBox = await SpinQuery.select('.watch-later-list .list-box')
if (listBox === null) {
return
}
resources.applyStyleFromText(`
.expire-warning {
padding: 3px 25px;
color: #F78C6C;
display: inline-flex;
align-items: center;
}
.expire-warning .mdi {
line-height: 1;
margin-right: 8px;
font-size: 16px;
}
`, 'watchlater-expire-warning-style')
// 少于此天数时提示
const WarningDays = settings.watchlaterExpireWarningDays
const DayInMilliseconds = 24 * 3600 * 1000
const getRemainingDays = (expireTime: number) => {
return (expireTime - Number(new Date())) / DayInMilliseconds
}
Observer.childListSubtree(listBox, async () => {
const states = [...listBox.querySelectorAll('.av-item .state')]
const list = await getWatchlaterList(true)
states.forEach((element, index) => {
// 60天后过期
const expireTime = list[index].add_at * 1000 + 60 * DayInMilliseconds
const days = getRemainingDays(expireTime)
console.log(list[index].aid, days)
if (days < WarningDays) {
if (element.querySelector('.expire-warning') === null) {
const displayDays = -Math.floor(-days) // 有小数直接上升一位整数
element.insertAdjacentHTML('afterbegin', /*html*/`
<span class="expire-warning" title="到期时间: ${new Date(expireTime).toLocaleString()}"><i class="mdi mdi-alert-circle-outline"></i>${displayDays}</span>`)
}
} else {
element.querySelectorAll('.expire-warning').forEach(it => it.remove())
}
})
})
})()

View File

@ -1,9 +0,0 @@
if (typeof isEmbeddedPlayer !== "undefined" && isEmbeddedPlayer())
{
return;
}
SpinQuery.condition(
() => document.querySelector(".bilibili-player-video video"),
it => it && it.paused === true,
it => it.play(),
);

View File

@ -1,4 +0,0 @@
.bilibili-player-video-danmaku-setting-wrap
{
display: none !important;
}

View File

@ -1,51 +0,0 @@
async function setCheckState (selector, value) {
const checkbox = await SpinQuery.select(() => document.querySelector(selector))
if (!checkbox) {
return
}
checkbox.checked = value
raiseEvent(checkbox, 'change')
}
Observer.videoChange(() => {
if (!settings.enableDanmaku) {
setCheckState('.bilibili-player-video-danmaku-switch>input', false)
}
if (settings.rememberDanmakuSettings) {
const selectors = {
subtitlesPreserve: '.bilibili-player-video-danmaku-setting-left-preventshade input',
smartMask: '.bilibili-player-video-danmaku-setting-left-danmaku-mask input'
}
async function applyDanmakuSettings () {
const panel = await SpinQuery.select(() => document.querySelector('.bilibili-player-video-danmaku-setting'))
if (!panel) {
return
}
await loadLazyPanel('.bilibili-player-video-danmaku-setting')
// bilibili will hides the panel after 200ms delay
setTimeout(() => resources.removeStyle('defaultDanmakuSettingsStyle'), 300)
for (const [type, value] of Object.entries(settings.danmakuSettings)) {
const element = await SpinQuery.select(() => document.querySelector(selectors[type]))
if (element !== null && element.checked !== undefined && element.checked !== value) {
element.click()
}
}
}
async function listenDanmakuSettingsChange () {
for (const type in settings.danmakuSettings) {
const element = await SpinQuery.select(() => document.querySelector(selectors[type]))
if (!element) {
return
}
element.addEventListener('click', () => {
settings.danmakuSettings = Object.assign(settings.danmakuSettings, {
[type]: element.checked
})
// settings.danmakuSettings[type] = element.checked;
})
}
}
applyDanmakuSettings()
listenDanmakuSettingsChange()
}
})

View File

@ -1,85 +0,0 @@
class LayoutCookie {
setCookie (key, value) {
document.cookie = `${key}=${value};path=/;domain=.bilibili.com;max-age=31536000`
}
clearCookie (key) {
document.cookie = `${key}=;path=/;domain=.bilibili.com;max-age=0`
}
getValue (key) {
return document.cookie.replace(new RegExp(`(?:(?:^|.*;\\s*)${key}\\s*\\=\\s*([^;]*).*$)|^.*$`), '$1')
}
checkSettings () {
return settings.useDefaultPlayerLayout
}
checkCookies () {}
useNewLayout () {}
useOldLayout () {}
setLayout (newLayout) {
if (newLayout) {
this.useNewLayout()
} else {
this.useOldLayout()
}
}
}
class VideoLayoutCookie extends LayoutCookie {
checkCookies () {
super.checkCookies()
const value = this.getValue(this.cookieKey)
if (value === '' || parseInt(value) < 0 && settings.defaultPlayerLayout !== '旧版') {
console.log(`default/old -> new`)
this.useNewLayout()
} else if (settings.defaultPlayerLayout !== '新版') {
console.log(`new -> old`)
this.useOldLayout()
}
}
constructor () {
super()
this.cookieKey = 'stardustvideo'
this.checkCookies()
}
useNewLayout () {
super.useNewLayout()
this.setCookie(this.cookieKey, 1)
}
useOldLayout () {
super.useOldLayout()
this.setCookie(this.cookieKey, -1)
}
}
class BangumiLayoutCookie extends LayoutCookie {
checkCookies () {
super.checkCookies()
const value = this.getValue(this.cookieKey)
if (value === '' || parseInt(value) <= 0 && settings.defaultBangumiLayout !== '旧版') {
console.log(`default/old -> new`)
this.useNewLayout()
} else if (settings.defaultBangumiLayout !== '新版') {
console.log(`new -> old`)
this.useOldLayout()
}
}
constructor () {
super()
this.cookieKey = 'stardustpgcv'
this.checkCookies()
}
useNewLayout () {
super.useNewLayout()
this.setCookie(this.cookieKey, '0606')
}
useOldLayout () {
super.useOldLayout()
this.setCookie(this.cookieKey, 0)
}
}
const videoCookie = new VideoLayoutCookie()
addSettingsListener('defaultPlayerLayout', value => {
videoCookie.setLayout(value === '新版')
})
const bangumiCookie = new BangumiLayoutCookie()
addSettingsListener('defaultBangumiLayout', value => {
bangumiCookie.setLayout(value === '新版')
})

View File

@ -1,6 +0,0 @@
unsafeWindow.Element.ALLOW_KEYBOARD_INPUT = {};
const originalRequestFullscreen = unsafeWindow.Element.prototype.requestFullscreen;
unsafeWindow.Element.prototype.requestFullscreen = function ()
{
originalRequestFullscreen.call(this);
};

View File

@ -1 +1 @@
1.11.16
1.11.17