forked from the1812/Bilibili-Evolved
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.js
9 lines (9 loc) · 6.36 KB
/
home.js
1
2
3
4
5
6
7
8
9
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["style/simplify/home"]=e():t["style/simplify/home"]=e()}(self,(function(){return function(){var t,e,n={344:function(t,e,n){var i=n(645)((function(t){return t[1]}));i.push([t.id,"body.simplifyHome-switch-categories .z-top-container.has-menu {\n height: auto !important;\n min-height: unset !important;\n}\nbody.simplifyHome-switch-categories .bili-header-m > .bili-wrapper {\n visibility: hidden !important;\n height: 18px !important;\n}\nbody.simplifyHome-switch-categories .primary-menu-itnl {\n visibility: hidden !important;\n height: 24px !important;\n padding: 0 !important;\n}\nbody.simplifyHome-switch-categories .bili-header__channel {\n height: 12px !important;\n}\nbody.simplifyHome-switch-categories .bili-header__channel > * {\n display: none !important;\n}\nbody.simplifyHome-switch-categories.header-v3 .bili-wrapper {\n padding-top: 8px !important;\n border-top: none !important;\n}\nbody.simplifyHome-switch-trends .first-screen #reportFirst1 {\n display: none !important;\n}\nbody.simplifyHome-switch-trends .first-screen .space-between {\n margin-bottom: 0 !important;\n}\nbody.simplifyHome-switch-trends .bili-layout .bili-grid:first-child,\nbody.simplifyHome-switch-trends .rcmd-box-wrap {\n display: none !important;\n}\nbody.simplifyHome-switch-online .first-screen #reportFirst2 {\n display: none !important;\n}\nbody.simplifyHome-switch-ext-box .first-screen #reportFirst3 {\n display: none !important;\n}\nbody.simplifyHome-switch-special #bili_report_spe_rec {\n display: none !important;\n}\nbody.simplifyHome-switch-contact .bili-footer .b-footer-wrap,\nbody.simplifyHome-switch-contact .international-footer {\n display: none !important;\n}\nbody.simplifyHome-switch-elevator .storey-box .elevator {\n display: none !important;\n}",""]),t.exports=i},645:function(t){"use strict";
// eslint-disable-next-line func-names
t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=t(e);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},
// eslint-disable-next-line func-names
e.i=function(t,n,i){"string"==typeof t&&(
// eslint-disable-next-line no-param-reassign
t=[[null,t,""]]);var o={};if(i)for(var r=0;r<this.length;r++){
// eslint-disable-next-line prefer-destructuring
var s=this[r][0];null!=s&&(o[s]=!0)}for(var a=0;a<t.length;a++){var l=[].concat(t[a]);i&&o[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),e.push(l))}},e}},910:function(t,e,n){var i=n(344);i&&i.__esModule&&(i=i.default),t.exports="string"==typeof i?i:i.toString()}},i={};function o(t){var e=i[t];if(void 0!==e)return e.exports;var r=i[t]={id:t,exports:{}};return n[t](r,r.exports,o),r.exports}e=Object.getPrototypeOf?function(t){return Object.getPrototypeOf(t)}:function(t){return t.__proto__},o.t=function(n,i){if(1&i&&(n=this(n)),8&i)return n;if("object"==typeof n&&n){if(4&i&&n.__esModule)return n;if(16&i&&"function"==typeof n.then)return n}var r=Object.create(null);o.r(r);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&i&&n;"object"==typeof a&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach((function(t){s[t]=function(){return n[t]}}));return s.default=function(){return n},o.d(r,s),r},o.d=function(t,e){for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return function(){"use strict";o.d(r,{component:function(){return p}});var t=coreApis.componentApis.switchOptions,e=coreApis.settings,n=coreApis.spinQuery,i=coreApis.style,s=coreApis.utils,a=coreApis.utils.urls;const l={name:"simplifyOptions",dimAt:"checked",switchProps:{checkedIcon:"mdi-eye-off-outline",notCheckedIcon:"mdi-eye-outline"},switches:{categories:{defaultValue:!1,displayName:"分区栏"},trends:{defaultValue:!1,displayName:"活动/热门视频"},online:{defaultValue:!1,displayName:"在线列表(旧)"},"ext-box":{defaultValue:!1,displayName:"电竞赛事(旧)"},special:{defaultValue:!1,displayName:"特别推荐(旧)"},contact:{defaultValue:!1,displayName:"联系方式"},elevator:{defaultValue:!1,displayName:"右侧分区导航(旧)"}}},c={name:"simplifyHome",displayName:"简化首页",description:{"zh-CN":"\n隐藏原版首页不需要的元素 / 分区.\n\n> 这个功能相当于 v1 的 `首页过滤`, v1 的 `简化首页` (清爽 / 极简首页) 需要重构后再发布, 问就是 Coming Soon.\n ".trim()},instantStyles:[{name:"simplifyHome",style:()=>Promise.resolve().then(o.t.bind(o,910,23))}],urlInclude:a.mainSiteUrls,tags:[componentsTags.style],entry:async()=>{if("https://www.bilibili.com/"!==document.URL)return;const{options:t}=(0,e.getComponentSettings)(c.name),o="-1"===(0,s.getCookieValue)("i-wanna-go-back"),r=await(async()=>{const t="https://www.bilibili.com/"!==document.URL;if(!o){const e=await(0,n.sq)((()=>dqa(".proxy-box > div")),(e=>e.length>0||t));return Object.fromEntries(e.map((t=>[t.id.replace(/^bili_/,""),{displayName:t.querySelector("header .name")?.textContent?.trim()??"未知分区",defaultValue:!1}])))}const e=["推广"],i=await(0,n.sq)((()=>dqa(".bili-grid .the-world")),(e=>e.length>3||t));console.log(i);const r=i?.filter((t=>!e.includes(t.id))).map((t=>{const e=(t=>{let e=t;for(;e.parentElement;){if(e.classList.contains("bili-grid"))return e;e=e.parentElement}return null})(t),n=t.id;return e?(e.dataset.area=n,[n,{displayName:n,defaultValue:!1}]):null})).filter((t=>null!==t))??[];return Object.fromEntries(r)})(),a={};Object.entries(r).forEach((([n,{displayName:i,defaultValue:o}])=>{const r={defaultValue:o,displayName:i},s=`switch-${n}`;void 0===t[s]&&(t[s]=o);const p=`switch-${n}`;(0,e.addComponentListener)(`${c.name}.${p}`,(t=>{document.body.classList.toggle(`${c.name}-${p}`,t)}),!0),l.switches[n]=r,a[n]=r})),t.simplifyOptions.switches=a;const p=Object.keys(r).map((t=>`\n body.simplifyHome-switch-${t} .bili-layout .bili-grid[data-area="${t}"],\n body.simplifyHome-switch-${t} .storey-box .proxy-box #bili_${t} {\n display: none !important;\n }\n `.trim())).join("\n");(0,i.addStyle)(p,"simplify-home-generated")}},p=(0,t.createSwitchOptions)(l)(c)}(),r=r.component}()}));