-
Notifications
You must be signed in to change notification settings - Fork 4
/
ckylin-bilibili-animated-showfullinfo.user.js
38 lines (37 loc) · 1.36 KB
/
ckylin-bilibili-animated-showfullinfo.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// ==UserScript==
// @name 哔哩哔哩-平滑展开视频信息
// @namespace ckylin-bilibili-animated-showfullinfo
// @version 0.2
// @description 平滑展开视频信息
// @author CKylinMC
// @match https://www.bilibili.com/video/*
// @grant none
// @license GPL-3.0-only
// ==/UserScript==
function CK_elementOk(){
return document.querySelector("#v_desc>div.info")||document.querySelector(".desc-info.desc-v2");
}
function CK_getRealHeight(){
try{
return document.querySelector("#v_desc>div.info").scrollHeight;
}catch(e){
return document.querySelector(".desc-info.desc-v2").scrollHeight;
}
}
window.CK_animatedFullInfo = false;
function CK_doAnimateFullInfoInject(){
if(window.CK_animatedFullInfo) return true;
if(!CK_elementOk()) return false;
let targetDom = document.querySelector("#CK_animatedFullInfoCSS");
if(targetDom) targetDom.remove();
targetDom = document.createElement("style");
targetDom.id = "CK_animatedFullInfoCSS";
targetDom.innerHTML = "#v_desc>div.info.open,.desc-info.desc-v2.open{height: "+CK_getRealHeight()+"px!important;}";
document.body.appendChild(targetDom);
window.CK_animatedFullInfo = true;
return true;
}
function CK_recheckAFI(){
if(!CK_doAnimateFullInfoInject()) setTimeout(()=>{CK_recheckAFI()},1000);
}
setInterval(()=>{CK_recheckAFI()},5000);