Add fullscreen fix option, update dark style

This commit is contained in:
the1812 2018-08-19 17:29:20 +08:00
parent 66a5b59fe9
commit bcc4ecada2
11 changed files with 94 additions and 21 deletions

View File

@ -96,6 +96,42 @@
将稍后再看的链接重定向为普通播放网址,以使用新版播放页面.
## 隐藏热搜词
将搜索框的热搜词替换为`搜索`.
## 全屏修复
修复点击全屏按钮无响应的问题.
点击全屏时, b站的源代码中会检查浏览器是否为`Chrome XX.X.XXX5.1`和`window.Element`是否包含`ALLOW_KEYBOARD_INPUT`属性, 然后向`requsetFullscreen`传递不同的参数. 而部分浏览器不允许向此API传参数, 全屏操作就会失败.
附:视频全屏代码
```js
request: function(c) {
var f = d.requestFullscreen;
c = c || document.documentElement;
if (/5\.1[\.\d]* Safari/.test(navigator.userAgent))
c[f]();
else
try {
var b = Element;
c[f](g && b.ALLOW_KEYBOARD_INPUT)
} catch (e) {
c[f]()
}
},
```
直播间全屏代码
```js
b.request = function(b) {
var a = c.requestFullscreen;
b = b || document.documentElement;
if (/5\.1[\.\d]* Safari/.test(window.navigator.userAgent))
b[a]();
else {
var g = Element
, d = !1;
g && "ALLOW_KEYBOARD_INPUT"in g && g.ALLOW_KEYBOARD_INPUT && (d = !0);
b[a](d)
}
}
```
## 直播间
### 缩放看板娘
根据屏幕DPI缩放看板娘的大小以提高像素的清晰度.
@ -120,6 +156,7 @@
- 删除广告: `开启`
- 稍后再看重定向: `开启`
- 隐藏热搜词: `关闭`
- 全屏修复: `关闭`
### 直播间
- 缩放看板娘: `开启`
- 删除直播水印: `开启`

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved (Preview)
// @version 1.1.4
// @version 1.1.5
// @description 增强哔哩哔哩Web端体验. (预览版分支)
// @author Grant Howard
// @match *://*.bilibili.com/*
@ -20,6 +20,7 @@
{
const $ = unsafeWindow.$ || self$;
const settings = {
fixFullscreen: false,
removeLiveWatermark: true,
harunaScale: true,
removeAds: true,
@ -305,7 +306,8 @@
watchLaterRedirect: "utils/watchlater.min.js",
hideTopSearch: "utils/hide-top-search.min.js",
harunaScale: "live/haruna-scale.min.js",
removeLiveWatermark: "live/remove-watermark.min.js"
removeLiveWatermark: "live/remove-watermark.min.js",
fixFullscreen: "utils/fix-fullscreen.min.js"
};
for (const key in urls)
{
@ -409,9 +411,6 @@
}
}
// Fix fullscreen not work @2018-08-12
unsafeWindow.Element.ALLOW_KEYBOARD_INPUT = {};
loadSettings();
const resources = new ExternalResource();
resources.fetch();

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved
// @version 1.1.4
// @version 1.1.5
// @description 增强哔哩哔哩Web端体验.
// @author Grant Howard
// @match *://*.bilibili.com/*
@ -20,6 +20,7 @@
{
const $ = unsafeWindow.$ || self$;
const settings = {
fixFullscreen: false,
removeLiveWatermark: true,
harunaScale: true,
removeAds: true,
@ -305,7 +306,8 @@
watchLaterRedirect: "utils/watchlater.min.js",
hideTopSearch: "utils/hide-top-search.min.js",
harunaScale: "live/haruna-scale.min.js",
removeLiveWatermark: "live/remove-watermark.min.js"
removeLiveWatermark: "live/remove-watermark.min.js",
fixFullscreen: "utils/fix-fullscreen.min.js"
};
for (const key in urls)
{
@ -409,9 +411,6 @@
}
}
// Fix fullscreen not work @2018-08-12
unsafeWindow.Element.ALLOW_KEYBOARD_INPUT = {};
loadSettings();
const resources = new ExternalResource();
resources.fetch();

File diff suppressed because one or more lines are too long

View File

@ -206,7 +206,10 @@ div.con,
.choice-item,
.radio-icon.selected,
.activity-item-ctnr .user-avatar,
.live-player-ctnr.minimal
.live-player-ctnr.minimal,
.activity-item-loading-ctnr .user-avatar,
.activity-item-loading-ctnr .info-ctnr .first-line,
.activity-item-loading-ctnr .info-ctnr .second-line
{
background-color: #222 !important;
}

View File

@ -1 +1 @@
.gui-settings-icon-panel{height:100%;display:flex;justify-content:center;align-items:center;position:fixed;top:0;left:0;width:24px;z-index:10000;}.gui-settings{display:flex;justify-content:center;align-items:center;cursor:pointer;-webkit-tap-highlight-color:transparent;transform:translateX(-12px);}.gui-settings,.gui-settings-header .gui-settings-close path,.gui-settings svg path{transition:all 0.2s;}.gui-settings svg path{fill:#8884;opacity:0.75;transform-origin:center!important;}.gui-settings:hover{transform:translateX(0px);}.gui-settings:hover svg path{opacity:1;transform:rotate(120deg);}.gui-settings-panel{transition:all 0.2s;width:100%;height:100%;background:transparent;position:fixed;left:0;top:0;z-index:10001;display:flex;opacity:0;transform:scale(0);transform-origin:center;align-items:center;justify-content:center;}.gui-settings-panel.opened{opacity:1;transform:scale(1);}.gui-settings-box{width:400px;height:90%;background:white;border-radius:8px;box-shadow:0px 3px 20px 2px #0004;display:flex;flex-direction:column;}.gui-settings-footer,.gui-settings-header{flex-grow:0;height:50px;display:flex;align-items:center;flex-shrink:0;}.gui-settings-footer{height:80px;justify-content:center;}.gui-settings-content{flex-grow:1;overflow:auto;position:relative;}.gui-settings-content-top-mask,.gui-settings-content-bottom-mask{height:10px;position:sticky;left:0px;width:100%;z-index:10;}.gui-settings-content-top-mask{background:linear-gradient(to bottom,white,transparent);top:0px;}.gui-settings-content-bottom-mask{background:linear-gradient(to top,white,transparent);bottom:0px;}.gui-settings-content ul{padding:0;margin:0;}.gui-settings-content ul li{font-size:16px;margin:12px 0;display:flex;}.gui-settings-content ul li.indent-0{margin-left:16px;}.gui-settings-content ul li.indent-1{margin-left:80px;}.gui-settings-content ul li.indent-2{margin-left:144px;}.gui-settings-content ul li.indent-center{align-items:center;justify-content:center;padding:8px 0;margin:0;border-top:1px dashed #8884;border-bottom:1px dashed #8884;}span.settings-category{opacity:0.6;}.gui-settings-title{flex-grow:1;font-size:16px;margin:16px;}.gui-settings-close{width:24px;height:24px;padding:16px;}.gui-settings-header .gui-settings-close{cursor:pointer;-webkit-tap-highlight-color:transparent;}.gui-settings-header .gui-settings-close:hover path{fill:$customStyleColor!important;}.gui-settings-close path{fill:#222;}.gui-settings-ok path{fill:transparent;}.gui-settings-textbox-container{display:flex;justify-content:center;align-items:center;-webkit-tap-highlight-color:transparent;}.gui-settings-textbox-container span{margin:0 16px;transition:all 0.2s;}.gui-settings-textbox-container input{border-radius:4px;border:none;height:100%;max-width:70px;padding:2px 8px;background:#8884;transition:all 0.2s;font-size:16px;}.gui-settings-textbox-container input:disabled,.gui-settings-textbox-container.disabled span,.gui-settings-textbox-container.disabled div{opacity:0.5;}.gui-settings-checkbox-container{cursor:pointer;display:flex;justify-content:center;align-items:center;padding:0 16px;-webkit-tap-highlight-color:transparent;}.gui-settings-checkbox-container input{opacity:0;width:0;transition:all 0.2s;}.gui-settings-checkbox-container svg{width:24px;height:24px;border-radius:4px;margin-right:16px;transition:all 0.2s;}.gui-settings-checkbox-container svg path{transform:scale(0.8);transform-origin:center;}.gui-settings-checkbox-container input ~ svg{background-color:#8884;}.gui-settings-checkbox-container input:checked ~ svg{background-color:$customStyleColor;}.gui-settings-checkbox-container input:checked ~ svg path{fill:$foreground;}.gui-settings-checkbox-container input:disabled ~ svg,.gui-settings-checkbox-container input:disabled ~ span{opacity:0.5;}button.save{padding:8px 32px;border:none;background:$customStyleColor;color:$foreground;border-radius:4px;font-size:16px;cursor:pointer;transition:all 0.2s;-webkit-tap-highlight-color:transparent;}button.save:focus{outline:none;}.gui-settings-footer svg{width:0;height:30px;margin-left:0;transition:all 0.2s;}.gui-settings-footer svg path{fill:$customStyleColor;}.custom-color-preview{width:40px;height:100%;border-radius:4px;background:$customStyleColor;margin-right:16px;border:1px solid #8884;position:relative;cursor:pointer;box-sizing:border-box;}.predefined-colors{transition:all 0.2s;display:flex;opacity:0;background:white;width:168px;height:168px;position:absolute;box-shadow:0px 3px 20px 2px #0004;border-radius:4px;top:32px;left:-64px;transform:scale(0);transform-origin:top;}.predefined-colors.opened{opacity:1;transform:scale(1);}.predefined-colors-grid{display:grid;grid-template-columns:auto auto auto auto;margin:4px;flex-grow:1;}.predefined-colors-grid-block{width:32px;height:32px;border-radius:4px;justify-self:center;align-self:center;cursor:pointer;}input[key]:focus{outline:none;}input[type='text'][key]{height:auto;border:none;border-radius:4px;}
.gui-settings-icon-panel{height:100%;display:flex;justify-content:center;align-items:center;position:fixed;top:0;left:0;width:24px;z-index:100000;}.gui-settings{display:flex;justify-content:center;align-items:center;cursor:pointer;-webkit-tap-highlight-color:transparent;transform:translateX(-12px);}.gui-settings,.gui-settings-header .gui-settings-close path,.gui-settings svg path{transition:all 0.2s;}.gui-settings svg path{fill:#8884;opacity:0.75;transform-origin:center!important;}.gui-settings:hover{transform:translateX(0px);}.gui-settings:hover svg path{opacity:1;transform:rotate(120deg);}.gui-settings-panel{transition:all 0.2s;width:100%;height:100%;background:transparent;position:fixed;left:0;top:0;z-index:10001;display:flex;opacity:0;transform:scale(0);transform-origin:center;align-items:center;justify-content:center;}.gui-settings-panel.opened{opacity:1;transform:scale(1);}.gui-settings-box{width:400px;height:90%;background:white;border-radius:8px;box-shadow:0px 3px 20px 2px #0004;display:flex;flex-direction:column;}.gui-settings-footer,.gui-settings-header{flex-grow:0;height:50px;display:flex;align-items:center;flex-shrink:0;}.gui-settings-footer{height:80px;justify-content:center;}.gui-settings-content{flex-grow:1;overflow:auto;position:relative;}.gui-settings-content-top-mask,.gui-settings-content-bottom-mask{height:10px;position:sticky;left:0px;width:100%;z-index:10;}.gui-settings-content-top-mask{background:linear-gradient(to bottom,white,transparent);top:0px;}.gui-settings-content-bottom-mask{background:linear-gradient(to top,white,transparent);bottom:0px;}.gui-settings-content ul{padding:0;margin:0;}.gui-settings-content ul li{font-size:16px;margin:12px 0;display:flex;}.gui-settings-content ul li.indent-0{margin-left:16px;}.gui-settings-content ul li.indent-1{margin-left:80px;}.gui-settings-content ul li.indent-2{margin-left:144px;}.gui-settings-content ul li.indent-center{align-items:center;justify-content:center;padding:8px 0;margin:0;border-top:1px dashed #8884;border-bottom:1px dashed #8884;}span.settings-category{opacity:0.6;}.gui-settings-title{flex-grow:1;font-size:16px;margin:16px;}.gui-settings-close{width:24px;height:24px;padding:16px;}.gui-settings-header .gui-settings-close{cursor:pointer;-webkit-tap-highlight-color:transparent;}.gui-settings-header .gui-settings-close:hover path{fill:$customStyleColor!important;}.gui-settings-close path{fill:#222;}.gui-settings-ok path{fill:transparent;}.gui-settings-textbox-container{display:flex;justify-content:center;align-items:center;-webkit-tap-highlight-color:transparent;}.gui-settings-textbox-container span{margin:0 16px;transition:all 0.2s;}.gui-settings-textbox-container input{border-radius:4px;border:none;height:100%;max-width:70px;padding:2px 8px;background:#8884;transition:all 0.2s;font-size:16px;}.gui-settings-textbox-container input:disabled,.gui-settings-textbox-container.disabled span,.gui-settings-textbox-container.disabled div{opacity:0.5;}.gui-settings-checkbox-container{cursor:pointer;display:flex;justify-content:center;align-items:center;padding:0 16px;-webkit-tap-highlight-color:transparent;}.gui-settings-checkbox-container input{opacity:0;width:0;transition:all 0.2s;}.gui-settings-checkbox-container svg{width:24px;height:24px;border-radius:4px;margin-right:16px;transition:all 0.2s;}.gui-settings-checkbox-container svg path{transform:scale(0.8);transform-origin:center;}.gui-settings-checkbox-container input ~ svg{background-color:#8884;}.gui-settings-checkbox-container input:checked ~ svg{background-color:$customStyleColor;}.gui-settings-checkbox-container input:checked ~ svg path{fill:$foreground;}.gui-settings-checkbox-container input:disabled ~ svg,.gui-settings-checkbox-container input:disabled ~ span{opacity:0.5;}button.save{padding:8px 32px;border:none;background:$customStyleColor;color:$foreground;border-radius:4px;font-size:16px;cursor:pointer;transition:all 0.2s;-webkit-tap-highlight-color:transparent;}button.save:focus{outline:none;}.gui-settings-footer svg{width:0;height:30px;margin-left:0;transition:all 0.2s;}.gui-settings-footer svg path{fill:$customStyleColor;}.custom-color-preview{width:40px;height:100%;border-radius:4px;background:$customStyleColor;margin-right:16px;border:1px solid #8884;position:relative;cursor:pointer;box-sizing:border-box;}.predefined-colors{transition:all 0.2s;display:flex;opacity:0;background:white;width:168px;height:168px;position:absolute;box-shadow:0px 3px 20px 2px #0004;border-radius:4px;top:32px;left:-64px;transform:scale(0);transform-origin:top;z-index:100;}.predefined-colors.opened{opacity:1;transform:scale(1);}.predefined-colors-grid{display:grid;grid-template-columns:auto auto auto auto;margin:4px;flex-grow:1;}.predefined-colors-grid-block{width:32px;height:32px;border-radius:4px;justify-self:center;align-self:center;cursor:pointer;}input[key]:focus{outline:none;}input[type='text'][key]{height:auto;border:none;border-radius:4px;}

View File

@ -8,7 +8,7 @@
top: 0;
left: 0;
width: 24px;
z-index: 10000;
z-index: 100000;
}
.gui-settings
{
@ -304,6 +304,7 @@ button.save:focus
left: -64px;
transform: scale(0);
transform-origin: top;
z-index: 100;
}
.predefined-colors.opened
{

15
utils/fix-fullscreen.js Normal file
View File

@ -0,0 +1,15 @@
(() =>
{
return () =>
{
unsafeWindow.Element.ALLOW_KEYBOARD_INPUT = {};
const originalRequsetFullscreen = unsafeWindow.Element.prototype.requestFullscreen;
unsafeWindow.Element.prototype.requestFullscreen = function ()
{
originalRequsetFullscreen.call(this);
};
return {
ajaxReload: false
};
}
})();

1
utils/fix-fullscreen.min.js vendored Normal file
View File

@ -0,0 +1 @@
(()=>{return()=>{unsafeWindow.Element.ALLOW_KEYBOARD_INPUT={};const e=unsafeWindow.Element.prototype.requestFullscreen;unsafeWindow.Element.prototype.requestFullscreen=function(){e.call(this)};return{ajaxReload:false}}})();

View File

@ -108,6 +108,15 @@
<span>隐藏热搜词</span>
</label>
</li>
<li class="indent-0">
<label class="gui-settings-checkbox-container">
<input key="fixFullscreen" type="checkbox" />
<svg class="gui-settings-ok" viewBox="0 0 24 24">
<path />
</svg>
<span>全屏修复</span>
</label>
</li>
<li class="indent-center">
<span class="settings-category">直播间</span>
</li>