-
Notifications
You must be signed in to change notification settings - Fork 328
/
bilibili_html5_full_screen_mode_optimize_style.user.js
112 lines (99 loc) · 3.45 KB
/
bilibili_html5_full_screen_mode_optimize_style.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// ==UserScript==
// @name Bilibili HTML5播放器网页全屏模式优化 脚本版
// @namespace http://tampermonkey.net/
// @version 1.0.2
// @description 移植自:http://userstyles.org/styles/131642
// @author ipcjs
// @include *://www.bilibili.com/video/av*
// @include *://www.bilibili.com/bangumi/play/*
// @include *://www.bilibili.com/html/html5player.html*
// @include *://www.bilibili.com/blackboard/player.html*
// @include *://www.bilibili.com/blackboard/html5player.html*
// @include *://www.bilibili.com/blackboard/html5playerbeta.html*
// @include *://www.bilibili.com/watchlater/*
// @grant none
// ==/UserScript==
'use strict'
const OLD_CSS = `
@namespace url(http://www.w3.org/1999/xhtml);
#bilibiliPlayer.mode-fullscreen .bilibili-player-video-sendbar {
transition: 0.2s;
opacity: 0!important;
}
#bilibiliPlayer.mode-fullscreen .bilibili-player-video-sendbar:hover {
opacity: 1!important;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-wrap{
height:100%!important;
width:100%!important;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-control{
/*display: block;*/
opacity: 0!important;
transition: 0.2s;
position:absolute;
bottom:0px;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-control:hover{
/*opacity: 0.7!important; */
opacity: 1!important;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-sendbar{
/*display: block;*/
opacity: 0!important;
transition: 0.2s;
position:absolute;
top:0px;
width:100%!important;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-sendbar:hover{
/*opacity: 0.8!important; */
opacity: 1!important;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-sendbar .bilibili-player-mode-selection-container{
height:120px;
border-radius: 5px;
top:100%;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-sendbar .bilibili-player-color-picker-container{
height:208px;
border-radius: 5px;
top:100%;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-info-container{
top:40px;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-float-lastplay{
bottom:30px;
}`
const NEW_CSS = `
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-control-wrap,
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-top,
#bilibiliPlayer.mode-fullscreen .bilibili-player-video-control-wrap,
#bilibiliPlayer.mode-fullscreen .bilibili-player-video-top
{
opacity: 0!important;
transition: 0.2s;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-control-wrap:hover,
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-top:hover,
#bilibiliPlayer.mode-fullscreen .bilibili-player-video-control-wrap:hover,
#bilibiliPlayer.mode-fullscreen .bilibili-player-video-top:hover
{
opacity: 1!important;
}
#bilibiliPlayer.mode-webfullscreen .bilibili-player-video-top,
#bilibiliPlayer.mode-fullscreen .bilibili-player-video-top
{
pointer-events: inherit!important;
}
`
function addStyle(css) {
let style = document.createElement('style')
style.innerHTML = css
document.querySelector('head').appendChild(style)
}
let isNewPlayer = document.querySelector('#entryOld > .old-btn > a, .entry-old > .btn-old') // 回到老版按钮
|| !document.querySelector('.new-entry > .btn') // 试用新版按钮
console.log(`isNewPlayer: ${isNewPlayer}`)
addStyle(isNewPlayer ? NEW_CSS : OLD_CSS)