Add simplify liveroom

This commit is contained in:
the1812 2019-03-30 19:14:03 +08:00
parent d4c0419233
commit dd4800e3ba
15 changed files with 201 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -20,6 +20,7 @@
// @grant GM_info
// @require https://code.jquery.com/jquery-3.2.1.min.js
// @require https://cdn.bootcss.com/jszip/3.1.5/jszip.min.js
// @require https://cdn.jsdelivr.net/npm/vue/dist/vue.js
// @icon https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/logo-small.png
// @icon64 https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/logo.png
// ==/UserScript==
@ -85,6 +86,17 @@ const settings = {
i18nLanguage: "日本語",
playerFocus: false,
oldTweets: false,
simplifyLiveroom: false,
simplifyLiveroomSettings: {
vip: true,
fansMedal: true,
title: true,
userLevel: true,
guard: true,
systemMessage: true,
welcomeMessage: true,
popup: false,
},
cache: {},
};
const fixedSettings = {

View File

@ -20,6 +20,7 @@
// @grant GM_info
// @require https://code.jquery.com/jquery-3.2.1.min.js
// @require https://cdn.bootcss.com/jszip/3.1.5/jszip.min.js
// @require https://cdn.jsdelivr.net/npm/vue/dist/vue.js
// @icon https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/images/logo-small.png
// @icon64 https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/images/logo.png
// ==/UserScript==
@ -85,6 +86,17 @@ const settings = {
i18nLanguage: "日本語",
playerFocus: false,
oldTweets: false,
simplifyLiveroom: false,
simplifyLiveroomSettings: {
vip: true,
fansMedal: true,
title: true,
userLevel: true,
guard: true,
systemMessage: true,
welcomeMessage: true,
popup: false,
},
cache: {},
};
const fixedSettings = {

View File

@ -15,7 +15,7 @@ style\dark\dark-navbar.css|A6F13E5BEFB239AAD022D7C8E74DA881526D6CAC
style\dark\dark-schedule.js|719209A73685195680C8E38D859B31169FBD1C5F
style\dark\dark-slice-1.css|76C17A84B82ACE5F37EEBEA9476DCB03D4C0D143
style\dark\dark-slice-2.css|D01C668FAB4A39F47E92728A3961EC2142428BAD
style\dark\dark-slice-3.css|2E58F7411FFBBB059F1F2FEC64B24DF70CAFF2A9
style\dark\dark-slice-3.css|26007B7DFE94D3FF0C4923BF77B4031D5424AF0C
style\dark\dark-slice-4.css|E9FE5F599A4B619465C3CEB179E53622BEEE53BF
style\dark\dark-slice-5.css|E843FC7EC998AD5B0271418EB3DD95395BE3DA6B
style\dark\dark-slice-6.css|1F59DAA74E0784C832F586C768D4B141E6612ED1
@ -31,8 +31,8 @@ style\override-navbar\override-navbar.js|442CD35A7825925F44C5A1934550F74DDBFB5FD
style\remove-top-mask.js|9E874B4D5A197BB25C8393B7AAEF433333D8EF84
style\remove-watermark.js|5F8324EDE38DD83508B9EA9159F6951F47D48AC2
style\scrollbar.css|D7DA1006F2603553A5595336CBA624DA735E9A27
style\simplify-liveroom\simplify-liveroom.css|DA39A3EE5E6B4B0D3255BFEF95601890AFD80709
style\simplify-liveroom\simplify-liveroom.js|DA39A3EE5E6B4B0D3255BFEF95601890AFD80709
style\simplify-liveroom\simplify-liveroom.css|0B691C5FF20D7A2CDC518784F0F4E06CB1186211
style\simplify-liveroom\simplify-liveroom.js|D3B9F956C436E0BFA2F010AAC09BC97E49F1D246
style\tweets.css|A4F3590FC4A0C05FA06659AF142293A3D1FE09D0
touch\combo-like.js|3140FCDD2FAA19AD54BB7BE3886C20DF1BC617B2
touch\player\touch-player.css|12B4618CFA4A140463FF00CC1720C2785D6C3D65
@ -48,7 +48,7 @@ utils\full-page-title\full-page-title.css|913155DCD240D6EE4B5E56DDFF26B477F3B9D7
utils\full-page-title\full-page-title.js|67AE307D02B5C913AB63A40C4D5D602929A97AF8
utils\full-tweets-title\full-tweets-title.css|277F4C806E1282E0618DAF421DEDA48AB91A6F7E
utils\full-tweets-title\full-tweets-title.js|9C396F97FB9A00B4E130FD6E6F09416D3F421148
utils\gui-settings\gui-settings.css|C53F0CD8AF7821B207E0BFEE97DEBADCE9720269
utils\gui-settings\gui-settings.css|3D63810AAD5A96EB3730F2CD9E008DAD0C6C47FD
utils\gui-settings\gui-settings.html|291E3E4E09C41D1B9BBC295672A9DFC2554E5C05
utils\gui-settings\gui-settings.js|C15EB153B5AAE682A2B75F9E63880D9363F832B4
utils\gui-settings\icons.css|7BF2BBBF488741AF21AC5FAFA1A54BAF39EF4FB7

View File

@ -20,6 +20,7 @@
// @grant GM_info
// @require https://code.jquery.com/jquery-3.2.1.min.js
// @require https://cdn.bootcss.com/jszip/3.1.5/jszip.min.js
// @require https://cdn.jsdelivr.net/npm/vue/dist/vue.js
// @icon https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/logo-small.png
// @icon64 https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/logo.png
// ==/UserScript==

View File

@ -60,6 +60,17 @@ export const settings = {
i18nLanguage: "日本語",
playerFocus: false,
oldTweets: false,
simplifyLiveroom: false,
simplifyLiveroomSettings: {
vip: true,
fansMedal: true,
title: true,
userLevel: true,
guard: true,
systemMessage: true,
welcomeMessage: true,
popup: false,
},
cache: {},
};
const fixedSettings = {

2
min/dark.min.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
WARNING: Invalid character(s) '' at 1:0. Ignoring.
.simplify-fansMedal .fans-medal-item-ctnr,.simplify-guard i.guard-icon,.simplify-popup .chat-popups-section,.simplify-popup .link-popup-ctnr,.simplify-systemMessage .system-msg,.simplify-title .title-label,.simplify-userLevel .user-level-icon,.simplify-vip .vip-icon,.simplify-welcomeMessage .welcome-guard,.simplify-welcomeMessage .welcome-msg{display:none!important}.simplify-liveroom-settings>ul>li{padding:8px 12px;display:flex;align-items:center}.simplify-liveroom-settings>ul>li:hover{background:rgba(0,0,0,.16)}

View File

@ -1 +1 @@
(()=>{return(r,e)=>{}})();
(()=>{return(e,i)=>{const t={vip:"姥爷图标",fansMedal:"粉丝勋章",title:"活动头衔",userLevel:"用户等级",guard:"舰长图标",systemMessage:"全区广播",welcomeMessage:"欢迎信息",popup:"抽奖提示"};return{widget:{condition:()=>document.URL.startsWith(`https://live.bilibili.com/`),content:`\n <div class="gui-settings-flat-button" style="position: relative" id="simplify-liveroom">\n <i class="mdi mdi-24px mdi-settings"></i>\n <span>简化直播间</span>\n <div class="simplify-liveroom-settings popup">\n <ul>\n <li v-for="item in items" v-on:click="itemClick(item)">\n <i class="mdi mdi-18px" v-bind:class="{'mdi-eye': !item.checked, 'mdi-eye-off': item.checked}"></i>\n {{item.name}}\n </li>\n </ul>\n </div>\n </div>\n `,success:()=>{document.querySelector("#simplify-liveroom").addEventListener("click",e=>{const i=document.querySelector(".simplify-liveroom-settings");if(i.contains(e.target)||e.target===i){return}i.classList.toggle("opened")});const i=(e,i)=>{const t=e?"add":"remove";document.body.classList[t](`simplify-${i}`)};new Vue({el:".simplify-liveroom-settings",data:{items:Object.entries(t).map(([t,s])=>{const n=e.simplifyLiveroomSettings[t];i(n,t);return{key:t,name:s,checked:n}})},methods:{itemClick(t){t.checked=!t.checked;i(t.checked,t.key);e.simplifyLiveroomSettings[t.key]=t.checked;GM_setValue("simplifyLiveroomSettings",e.simplifyLiveroomSettings)}}})}}}}})();

View File

@ -73,7 +73,8 @@ div#square.container,
.open-dialog-masker .open-dialog-content,
.bnj-comment .page-comment,
.play-options .play-options-more .play-options-content .play-option,
.play-options .share-box
.play-options .share-box,
.gui-settings-flat-button .popup
{
background-color: #222 !important;
}

View File

@ -0,0 +1,23 @@
.simplify-vip .vip-icon,
.simplify-fansMedal .fans-medal-item-ctnr,
.simplify-title .title-label,
.simplify-userLevel .user-level-icon,
.simplify-guard i.guard-icon,
.simplify-systemMessage .system-msg,
.simplify-welcomeMessage .welcome-guard,
.simplify-welcomeMessage .welcome-msg,
.simplify-popup .chat-popups-section,
.simplify-popup .link-popup-ctnr
{
display: none !important;
}
.simplify-liveroom-settings>ul>li
{
padding: 8px 12px;
display: flex;
align-items: center;
}
.simplify-liveroom-settings>ul>li:hover
{
background: rgba(0,0,0,0.16);
}

View File

@ -0,0 +1,68 @@
const displayNames = {
vip: "姥爷图标",
fansMedal: "粉丝勋章",
title: "活动头衔",
userLevel: "用户等级",
guard: "舰长图标",
systemMessage: "全区广播",
welcomeMessage: "欢迎信息",
popup: "抽奖提示",
}
export default {
widget: {
condition: () => document.URL.startsWith(`https://live.bilibili.com/`),
content: /*html*/`
<div class="gui-settings-flat-button" style="position: relative" id="simplify-liveroom">
<i class="mdi mdi-24px mdi-settings"></i>
<span>简化直播间</span>
<div class="simplify-liveroom-settings popup">
<ul>
<li v-for="item in items" v-on:click="itemClick(item)">
<i class="mdi mdi-18px" v-bind:class="{'mdi-eye': !item.checked, 'mdi-eye-off': item.checked}"></i>
{{item.name}}
</li>
</ul>
</div>
</div>
`,
success: () =>
{
document.querySelector("#simplify-liveroom").addEventListener("click", e =>
{
const settingsList = document.querySelector(".simplify-liveroom-settings");
if (settingsList.contains(e.target) || e.target === settingsList)
{
return;
}
settingsList.classList.toggle("opened");
});
const setBodyClass = (checked, key) =>
{
const method = checked ? "add" : "remove";
document.body.classList[method](`simplify-${key}`);
};
new Vue({
el: ".simplify-liveroom-settings",
data: {
items: Object.entries(displayNames).map(([key, name]) =>
{
const checked = settings.simplifyLiveroomSettings[key];
setBodyClass(checked, key);
return {
key, name, checked
};
}),
},
methods: {
itemClick(item)
{
item.checked = !item.checked;
setBodyClass(item.checked, item.key);
settings.simplifyLiveroomSettings[item.key] = item.checked;
GM_setValue("simplifyLiveroomSettings", settings.simplifyLiveroomSettings);
},
},
});
},
},
};

View File

@ -589,4 +589,34 @@ li.category.folded i.icon-arrow
.player-full-win .live-room-app .app-content
{
z-index: 100000 !important;
}
.gui-settings-flat-button .popup
{
position: absolute;
top: calc(100% + 2px);
transition: all .16s ease-out;
transform-origin: top;
transform: scaleY(0) translateX(-50%);
left: 50%;
background: white;
box-shadow: 0px 3px 20px 2px #0004;
z-index: 200;
display: flex;
flex-direction: column;
align-items: center;
width: max-content;
}
.gui-settings-flat-button .popup *
{
transition: all 0.2s;
}
.gui-settings-flat-button .popup.opened
{
transform: scaleY(1) translateX(-50%);
}
.gui-settings-flat-button .popup ul
{
list-style: none;
margin: 0;
padding: 0;
}