text: (()=>{return(i,t)=>{if(isIframe()){return}document.body.style.setProperty("--navbar-bounds-padding",`0 ${i.customNavbarBoundsPadding}%`);document.body.style.setProperty("--navbar-blur-opacity",i.customNavbarBlurOpacity||.7);addSettingsListener("customNavbarBlurOpacity",i=>{document.body.style.setProperty("--navbar-blur-opacity",i)});let e=true;const a={widget:{content:`\n      <div class="gui-settings-flat-button" id="custom-navbar-settings">\n        <i class="mdi mdi-24px mdi-auto-fix"></i>\n        <span>顶栏布局</span>\n      </div>`,condition:()=>e,success:async()=>{await SpinQuery.select(".custom-navbar-settings");await t.importAsync("slip");const{debounce:e}=await t.importAsync("debounce");const a=document.querySelector("#custom-navbar-settings");a.addEventListener("click",async()=>{const i=dq(".custom-navbar-settings");if(i){i.classList.toggle("show");document.querySelector(".gui-settings-mask").click()}});a.addEventListener("mouseover",()=>{const t={blank1:"弹性空白1",logo:"Logo",category:"主站",rankingLink:"排行",drawingLink:"相簿",musicLink:"音频",gamesIframe:"游戏中心",livesIframe:"直播",shopLink:"会员购",mangaLink:"漫画",blank2:"弹性空白2",search:"搜索框",userInfo:"用户信息",messages:"消息",activities:"动态",bangumi:"订阅",watchlaterList:"稍后再看",favoritesList:"收藏",historyList:"历史",upload:"投稿入口",blank3:"弹性空白3"};Vue.component("order-item",{props:["item"],template:`\n            <li v-on:mouseenter="viewBorder(true)"\n                v-on:mouseleave="viewBorder(false)"\n                v-bind:class="{hidden: hidden()}">\n              <i class="mdi mdi-menu"></i>\n              {{item.displayName}}\n              <button v-on:click="toggleHidden()">\n                  <i v-if="hidden()" class="mdi mdi-eye-off"></i>\n                  <i v-else class="mdi mdi-eye"></i>\n              </button>\n            </li>\n          `,methods:{hidden(){return i.customNavbarHidden.includes(this.item.name)},viewBorder(i){const t=document.querySelector(`.custom-navbar li[data-name='${this.item.name}']`);if(t!==null){t.classList[i?"add":"remove"]("view-border")}},toggleHidden(){const t=this.hidden();if(t===false){i.customNavbarHidden.push(this.item.name);i.customNavbarHidden=i.customNavbarHidden}else{const t=i.customNavbarHidden.indexOf(this.item.name);if(t===-1){return}i.customNavbarHidden.splice(t,1);i.customNavbarHidden=i.customNavbarHidden}this.$forceUpdate();const e=document.querySelector(`.custom-navbar li[data-name='${this.item.name}']`);if(e!==null){e.style.display=t?"flex":"none"}}}});const a=e(t=>{i.customNavbarBoundsPadding=t;document.body.style.setProperty("--navbar-bounds-padding",`0 ${t}%`)},200);new Vue({el:".custom-navbar-settings",mounted(){const t=document.querySelector(".custom-navbar-settings .order-list");const e=({sourceItem:e,targetItem:a,orderBefore:s,orderAfter:n})=>{if(s===n){return}const l=Object.entries(i.customNavbarOrder).filter(([i])=>i in customNavbarDefaultOrders);const o=l.sort((i,t)=>i[1]-t[1]).map(i=>i[0]);if(s<n){for(let t=s+1;t<=n;t++){const e=o[t];i.customNavbarOrder[e]=t-1;document.querySelector(`.custom-navbar li[data-name='${e}']`).style.order=t-1}}else{for(let t=s-1;t>=n;t--){const e=o[t];i.customNavbarOrder[e]=t+1;document.querySelector(`.custom-navbar li[data-name='${e}']`).style.order=t+1}}i.customNavbarOrder[o[s]]=n;document.querySelector(`.custom-navbar li[data-name='${o[s]}']`).style.order=n;i.customNavbarOrder=i.customNavbarOrder;t.insertBefore(e,a)};new Slip(t);t.addEventListener("slip:beforewait",i=>{if(i.target.classList.contains("mdi-menu")){i.preventDefault()}},false);t.addEventListener("slip:beforeswipe",i=>i.preventDefault(),false);t.addEventListener("slip:reorder",i=>{e({sourceItem:i.target,targetItem:i.detail.insertBefore,orderBefore:i.detail.originalIndex,orderAfter:i.detail.spliceIndex});return false},false)},computed:{orderList(){const e=Object.entries(i.customNavbarOrder);return e.filter(i=>i[0]in t).sort((i,t)=>i[1]-t[1]).map(i=>{return{displayName:t[i[0]],name:i[0],order:i[1]}})}},data:{boundsPadding:i.customNavbarBoundsPadding},watch:{boundsPadding(i){a(i)}},methods:{close(){document.querySelector(".custom-navbar-settings").classList.remove("show")},restoreDefault(){if(typeof customNavbarDefaultOrders==="undefined"){Toast.error("未找到默认值设定, 请更新您的脚本.");return}if(confirm("确定要恢复默认顶栏布局吗? 恢复后页面将刷新.")){this.boundsPadding=5;i.customNavbarOrder=customNavbarDefaultOrders;location.reload()}}}})},{once:true})}},unload:()=>{const i=document.querySelectorAll(".custom-navbar,.custom-navbar-settings");i.forEach(i=>i.style.display="none");t.removeStyle("customNavbarStyle")},reload:()=>{const i=document.querySelectorAll(".custom-navbar,.custom-navbar-settings");i.forEach(i=>i.style.display="flex");t.applyImportantStyle("customNavbarStyle")}};const s=(i,t,e)=>{e.classList[t?"add":"remove"](i)};const n=i=>{document.querySelector(".custom-navbar").classList[i?"add":"remove"]("dark");document.querySelector(".custom-navbar-settings").classList[i?"add":"remove"]("dark")};addSettingsListener("allNavbarFill",i=>s("all-navbar-fill",i,document.body));s("all-navbar-fill",i.allNavbarFill,document.body);const l=["/www.bilibili.com","/t.bilibili.com","/search.bilibili.com","/space.bilibili.com","/account.bilibili.com","/pay.bilibili.com","/member.bilibili.com","/big.bilibili.com","/message.bilibili.com","/app.bilibili.com","/passport.bilibili.com","/game.bilibili.com"];const o=["/t.bilibili.com/lottery/h5/index/#/result","/member.bilibili.com/video/upload","/space.bilibili.com/ajax/"];if(!l.some(i=>document.URL.includes(i))||o.some(i=>document.URL.includes(i))){e=false;return a}document.body.classList.add("custom-navbar-loading");let c={};let r={};let d;class m{constructor(){this.html=``;this.popupHtml=``;this.flex=`0 0 auto`;this.disabled=false;this.requestedPopup=false;this.initialPopup=null;this.onPopup=null;this.href=null;this.notifyCount=0;this.touch=i.touchNavBar;this.active=false}get name(){return"undefined"}get order(){return i.customNavbarOrder[this.name]}get hidden(){return i.customNavbarHidden.includes(this.name)}async setNotifyCount(i){const t=await SpinQuery.select(`.custom-navbar li[data-name='${this.name}'] .notify-count`);if(!t||!i){t.innerHTML="";return}t.innerHTML=i}}class u extends m{constructor(i){super();this.number=i;this.flex="1 0 auto";this.disabled=true}get name(){return"blank"+this.number}}class p extends m{constructor(){super();this.href=`https://www.bilibili.com/`;this.html=`<i class="custom-navbar-iconfont custom-navbar-icon-logo"></i>`;this.touch=false}get name(){return"logo"}}class b extends m{constructor(i,t,e){super();this.linkName=e;this.html=i;this.href=t;this.touch=false;this.active=document.URL.startsWith(t)}get name(){return this.linkName+"Link"}}class h extends m{constructor(){super();this.href="https://member.bilibili.com/v2#/upload/video/frame";this.html=`\n      <svg style="width:16px;height:16px;padding:3px;box-sizing:content-box;" viewBox="0 0 785 886">\n        <path d="M582,374L582,566C582,585.333 576.167,600.833 564.5,612.5C552.833,624.167 537.333,630 518,630L262,630C242.667,630 227.167,624.167 215.5,612.5C203.833,600.833 198,585.333 198,566L198,374L32,374C22,374 14.1667,371.167 8.5,365.5C2.83333,359.833 0,352 0,342C0,338.667 1.16666,334.5 3.5,329.5C5.83333,324.5 8.66666,320 12,316L371,9C377.667,3.00006 385.167,6.10352e-005 393.5,0C401.833,6.10352e-005 409.333,3.00006 416,9L774,316C780,322.667 783.333,330.167 784,338.5C784.667,346.833 783.333,354.333 780,361L764,370C760,372.667 754.667,374 748,374ZM70,758L710,758C729.333,758 744.833,763.833 756.5,775.5C768.167,787.167 774,802.667 774,822C774,841.333 768.167,856.833 756.5,868.5C744.833,880.167 729.333,886 710,886L70,886C50.6667,886 35.1667,880.167 23.5,868.5C11.8333,856.833 6,841.333 6,822C6,802.667 11.8333,787.167 23.5,775.5C35.1667,763.833 50.6667,758 70,758Z" />\n      </svg>\n      <div id="upload-button">投稿</div>`;this.popupHtml=`\n      <ul id="upload-actions">\n        <li><a target="_blank" href="https://member.bilibili.com/v2#/upload/text/apply">专栏投稿</a></li>\n        <li><a target="_blank" href="https://member.bilibili.com/v2#/upload/audio/">音频投稿</a></li>\n        <li><a target="_blank" href="https://member.bilibili.com/v2#/upload/video/frame">视频投稿</a></li>\n        <li><a target="_blank" href="https://member.bilibili.com/v2#/upload-manager/article">投稿管理</a></li>\n        <li><a target="_blank" href="https://member.bilibili.com/v2#/home">创作中心</a></li>\n      </ul>\n    `}get name(){return"upload"}}class v extends m{constructor(){super();this.href="https://message.bilibili.com/";this.html="消息";this.popupHtml=`\n      <ul id="message-list">\n        <li><a data-name="reply_me" target="_blank" href="https://message.bilibili.com/#/reply">回复我的</a></li>\n        <li><a data-name="at_me" target="_blank" href="https://message.bilibili.com/#/at">@我的</a></li>\n        <li><a data-name="praise_me" target="_blank" href="https://message.bilibili.com/#/love">收到的赞</a></li>\n        <li><a data-name="notify_me" target="_blank" href="https://message.bilibili.com/#/system">系统通知</a></li>\n      </ul>\n    `;this.requestedPopup=true;this.active=document.URL.startsWith("https://message.bilibili.com/");this.init()}get name(){return"messages"}async init(){const i=await Ajax.getJsonWithCredentials("https://message.bilibili.com/api/notify/query.notify.count.do");const t=await SpinQuery.select("#message-list");const e=[...t.querySelectorAll("a[data-name]")];const a=e.map(i=>i.getAttribute("data-name"));if(i.code!==0){return}let s=a.reduce((t,e)=>t+i.data[e],0);if(!s){return}await this.setNotifyCount(s);a.forEach((t,a)=>{const s=i.data[t];if(s>0){e[a].setAttribute("data-count",s)}else{e[a].removeAttribute("data-count")}});e.forEach(i=>{i.addEventListener("click",()=>{const t=i.getAttribute("data-count");i.removeAttribute("data-count");s-=t;this.setNotifyCount(s)})})}}class w extends m{constructor(){super();this.html=`主站`;this.popupHtml=`\n      <ul id="custom-navbar-home-popup">\n        <li class="category-item" v-if="loading">\n          <i class="mdi mdi-18px mdi-loading mdi-spin" style="margin-right: 8px"></i>加载中...\n        </li>\n        <li class="category-item" style="display: none" :style="{display: loading ? 'none' : 'list-item'}" v-for="item of info" :class="{ main: item[1].count }">\n          <a :href="item[1].link">\n            <svg aria-hidden="true">\n              <use :href="'#header-icon-' + item[1].icon" :xlink:href="'#header-icon-' + item[1].icon"></use>\n            </svg>\n            <div>{{item[0]}}</div>\n            <span>{{item[1].count}}</span>\n          </a>\n          <div class="popup" v-if="item[1].subRegions">\n            <a v-for="region of Object.entries(item[1].subRegions)" :href="region[1]">\n              {{region[0]}}\n            </a>\n          </div>\n        </li>\n      </ul>\n    `;const i=async()=>{const i=await Ajax.getJson("https://api.bilibili.com/x/web-interface/online");if(parseInt(i.code)!==0){throw new Error(`[自定义顶栏] 分区投稿信息获取失败: ${i.message}`)}const t=i.data.region_count;await SpinQuery.select("#custom-navbar-home-popup");return{"动画":{icon:"douga",count:t[1],link:`https://www.bilibili.com/v/douga/`,subRegions:{"MAD·AMV":`https://www.bilibili.com/v/douga/mad/`,"MMD·3D":`https://www.bilibili.com/v/douga/mmd/`,"短片·手书·配音":`https://www.bilibili.com/v/douga/voice/`,"综合":`https://www.bilibili.com/v/douga/other/`}},"番剧":{icon:"anime",count:t[13],link:`https://www.bilibili.com/anime/`,subRegions:{"连载动画":`https://www.bilibili.com/v/anime/serial/`,"完结动画":`https://www.bilibili.com/v/anime/finish/`,"资讯":`https://www.bilibili.com/v/anime/information/`,"官方延伸":`https://www.bilibili.com/v/anime/offical/`,"新番时间表":`https://www.bilibili.com/anime/timeline/`}},"国创":{icon:"guochuang",count:t[167],link:`https://www.bilibili.com/guochuang/`,subRegions:{"国产动画":`https://www.bilibili.com/v/guochuang/chinese/`,"国产原创相关":`https://www.bilibili.com/v/guochuang/original/`,"布袋戏":`https://www.bilibili.com/v/guochuang/puppetry/`,"资讯":`https://www.bilibili.com/v/guochuang/information/`,"新番时间表":`https://www.bilibili.com/guochuang/timeline/`,"国产动画索引":`https://www.bilibili.com/guochuang/index/`}},"音乐":{icon:"music",count:t[3],link:`https://www.bilibili.com/v/music/`,subRegions:{"原创音乐":"https://www.bilibili.com/v/music/original/","翻唱":"https://www.bilibili.com/v/music/cover/","VOCALOID·UTAU":"https://www.bilibili.com/v/music/vocaloid/","电音":"https://www.bilibili.com/v/music/electronic/","演奏":"https://www.bilibili.com/v/music/perform/",MV:"https://www.bilibili.com/v/music/mv/","音乐现场":"https://www.bilibili.com/v/music/live/","音乐综合":"https://www.bilibili.com/v/music/other/","音频":"https://www.bilibili.com/audio/home?musicType=music"}},"舞蹈":{icon:"dance",count:t[129],link:`https://www.bilibili.com/v/dance/`,subRegions:{"宅舞":"https://www.bilibili.com/v/dance/otaku/","三次元舞蹈":"https://www.bilibili.com/v/dance/three_d/","舞蹈教程":"https://www.bilibili.com/v/dance/demo/"}},"游戏":{icon:"game",count:t[4],link:`https://www.bilibili.com/v/game/`,subRegions:{"单机游戏":"https://www.bilibili.com/v/game/stand_alone/","电子竞技":"https://www.bilibili.com/v/game/esports/","手机游戏":"https://www.bilibili.com/v/game/mobile/","网络游戏":"https://www.bilibili.com/v/game/online/","桌游棋牌":"https://www.bilibili.com/v/game/board/",GMV:"https://www.bilibili.com/v/game/gmv/","音游":"https://www.bilibili.com/v/game/music/",Mugen:"https://www.bilibili.com/v/game/mugen/","游戏赛事":"https://www.bilibili.com/v/game/match/"}},"科技":{icon:"technology",count:t[36],link:`https://www.bilibili.com/v/technology/`,subRegions:{"趣味科普人文":"https://www.bilibili.com/v/technology/fun/","野生技术协会":"https://www.bilibili.com/v/technology/wild/","演讲·公开课":"https://www.bilibili.com/v/technology/speech_course/","星海":"https://www.bilibili.com/v/technology/military/","机械":"https://www.bilibili.com/v/technology/mechanical/","汽车":"https://www.bilibili.com/v/technology/automobile/"}},"数码":{icon:"digital",count:t[188],link:`https://www.bilibili.com/v/digital/`,subRegions:{"手机平板":"https://www.bilibili.com/v/digital/mobile/","电脑装机":"https://www.bilibili.com/v/digital/pc/","摄影摄像":"https://www.bilibili.com/v/digital/photography/","影音智能":"https://www.bilibili.com/v/digital/intelligence_av/"}},"生活":{icon:"life",count:t[160],link:`https://www.bilibili.com/v/life/`,subRegions:{"搞笑":"https://www.bilibili.com/v/life/funny/","日常":"https://www.bilibili.com/v/life/daily/","美食圈":"https://www.bilibili.com/v/life/food/","动物圈":"https://www.bilibili.com/v/life/animal/","手工":"https://www.bilibili.com/v/life/handmake/","绘画":"https://www.bilibili.com/v/life/painting/","运动":"https://www.bilibili.com/v/life/sports/","其他":"https://www.bilibili.com/v/life/other/"}},"鬼畜":{icon:"kichiku",count:t[119],link:`https://www.bilibili.com/v/kichiku/`,subRegions:{"鬼畜调教":"https://www.bilibili.com/v/kichiku/guide/","音MAD":"https://www.bilibili.com/v/kichiku/mad/","人力VOCALOID":"https://www.bilibili.com/v/kichiku/manual_vocaloid/","教程演示":"https://www.bilibili.com/v/kichiku/course/"}},"时尚":{icon:"fashion",count:t[155],link:`https://www.bilibili.com/v/fashion/`,subRegions:{"美妆":"https://www.bilibili.com/v/fashion/makeup/","服饰":"https://www.bilibili.com/v/fashion/clothing/","健身":"https://www.bilibili.com/v/fashion/aerobics/","T台":"https://www.bilibili.com/v/fashion/catwalk/","风尚标":"https://www.bilibili.com/v/fashion/trends/"}},"广告":{icon:"ad",count:t[165],link:`https://www.bilibili.com/v/ad/ad/`},"娱乐":{icon:"ent",count:t[5],link:`https://www.bilibili.com/v/ent/`,subRegions:{"综艺":"https://www.bilibili.com/v/ent/variety/","明星":"https://www.bilibili.com/v/ent/star/","Korea相关":"https://www.bilibili.com/v/ent/korea/"}},"影视":{icon:"cinephile",count:t[181],link:`https://www.bilibili.com/v/cinephile/`,subRegions:{"影视杂谈":"https://www.bilibili.com/v/cinephile/cinecism/","影视剪辑":"https://www.bilibili.com/v/cinephile/montage/","短片":"https://www.bilibili.com/v/cinephile/shortfilm/","预告·资讯":"https://www.bilibili.com/v/cinephile/trailer_info/","特摄":"https://www.bilibili.com/v/cinephile/tokusatsu/"}},"放映厅":{icon:"cinema",count:t[177]+t[23]+t[11],link:`https://www.bilibili.com/cinema/`,subRegions:{"纪录片":"https://www.bilibili.com/documentary/","电影":"https://www.bilibili.com/movie/","电视剧":"https://www.bilibili.com/tv/"}},"专栏":{icon:"read",count:``,link:`https://www.bilibili.com/read/home`},"直播":{icon:"zhibo",count:``,link:`https://live.bilibili.com`,subRegions:{"全部直播":"https://live.bilibili.com/all?visit_id=5icxsa0kmts0","游戏直播":"https://live.bilibili.com/p/eden/area-tags?parentAreaId=2&areaId=0&visit_id=5icxsa0kmts0#/2/0","手游直播":"https://live.bilibili.com/p/eden/area-tags?parentAreaId=3&areaId=0&visit_id=5icxsa0kmts0#/3/0","娱乐直播":"https://live.bilibili.com/p/eden/area-tags?parentAreaId=1&areaId=0&visit_id=5icxsa0kmts0#/1/0","电台直播":"https://live.bilibili.com/p/eden/area-tags?parentAreaId=5&areaId=0&visit_id=5icxsa0kmts0#/5/0","绘画直播":"https://live.bilibili.com/p/eden/area-tags?parentAreaId=4&areaId=0&visit_id=5icxsa0kmts0#/4/0"}},"小黑屋":{icon:"blackroom",count:``,link:`https://www.bilibili.com/blackroom/`},"话题":{icon:"topic",count:``,link:`https://www.bilibili.com/blackboard/topic_list.html`},"活动":{icon:"activit",count:``,link:`https://www.bilibili.com/blackboard/x/act_list`}}};this.initialPopup=(async()=>{new Vue({el:await SpinQuery.select("#custom-navbar-home-popup"),data:{info:[],loading:true},async mounted(){try{this.info=Object.entries(await i())}finally{this.loading=false}}})})}get name(){return"category"}}class g extends m{constructor(){super();this.noPadding=true;this.href="https://space.bilibili.com";this.html=`\n      <div class="user-face-container">\n        <img src='data:image/svg+xml;utf-8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"></svg>' class="user-face"></img>\n        <img src='data:image/svg+xml;utf-8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"></svg>' class="user-pendant"></img>\n      </div>\n    `;this.popupHtml=`\n      <div class="user-info-panel">\n        <div v-if="isLogin" class="logged-in">\n          <a class="name" target="_blank" href="https://space.bilibili.com/">{{uname}}</a>\n          <a class="type" target="_blank" href="https://account.bilibili.com/account/big">{{userType}}</a>\n          <div class="level-info row">\n            <a target="_blank" title="等级" href="https://account.bilibili.com/account/record"\n              class="level">\n              <i class="custom-navbar-iconfont-extended" v-bind:class="'custom-navbar-icon-lv' + level_info.current_level"></i>\n            </a>\n            <span class="level-progress-label">{{level_info.current_exp}} / {{level_info.next_exp}}</span>\n          </div>\n          <div class="level-progress separator">\n            <div class="level-progress-thumb" v-bind:style="levelProgressStyle"></div>\n          </div>\n          <div class="items">\n            <a class="item" target="_blank" title="手机验证"\n              href="https://passport.bilibili.com/account/security#/bindphone">\n              <i class="custom-navbar-iconfont-new-home custom-navbar-icon-bind-phone"></i>\n              <i v-if="mobile_verified" class="custom-navbar-iconfont-new-home custom-navbar-icon-ok"></i>\n              <i v-else class="custom-navbar-iconfont-new-home custom-navbar-icon-cancel"></i>\n            </a>\n            <a class="item" target="_blank" title="邮箱验证"\n              href="https://passport.bilibili.com/account/security#/bindmail">\n              <i class="custom-navbar-iconfont-new-home custom-navbar-icon-bind-email"></i>\n              <i v-if="email_verified" class="custom-navbar-iconfont-new-home custom-navbar-icon-ok"></i>\n              <i v-else class="custom-navbar-iconfont-new-home custom-navbar-icon-cancel"></i>\n            </a>\n            <a class="item" target="_blank" href="https://account.bilibili.com/site/coin" title="硬币">\n              <i class="custom-navbar-iconfont-new-home custom-navbar-icon-coin"></i>\n              <span>{{money}}</span>\n            </a>\n            <a class="item" target="_blank" href="https://pay.bilibili.com/bb_balance.html" title="B币">\n              <i class="custom-navbar-iconfont-new-home custom-navbar-icon-b-coin"></i>\n              <span>{{wallet.bcoin_balance}}</span>\n            </a>\n          </div>\n          <div class="separator"></div>\n          <a class="operation" target="_blank" href="https://account.bilibili.com/account/home">\n            <i class="icon custom-navbar-icon-profile custom-navbar-iconfont-new-home"></i>\n            个人中心\n          </a>\n          <a class="operation" target="_blank" href="https://member.bilibili.com/v2#/upload-manager/article">\n            <i class="icon custom-navbar-icon-posts custom-navbar-iconfont-new-home"></i>\n            投稿管理\n          </a>\n          <a class="operation" target="_blank" href="https://pay.bilibili.com/">\n            <i class="icon custom-navbar-icon-wallet custom-navbar-iconfont-new-home"></i>\n            B币钱包\n          </a>\n          <a class="operation" target="_blank" href="https://link.bilibili.com/p/center/index">\n            <i class="icon custom-navbar-icon-live-center custom-navbar-iconfont-new-home"></i>\n            直播中心\n          </a>\n          <a class="operation" target="_blank" href="https://show.bilibili.com/orderlist">\n            <i class="icon custom-navbar-icon-order-center custom-navbar-iconfont-new-home"></i>\n            订单中心\n          </a>\n          <a class="logout grey-button" href="https://account.bilibili.com/login?act=exit">\n            退出登录\n          </a>\n        </div>\n        <div v-else class="not-logged-in">\n          <h1 class="welcome">欢迎来到 bilibili</h1>\n          <a href="https://passport.bilibili.com/register/phone.html" class="signup grey-button">注册</a>\n          <a href="https://passport.bilibili.com/login" class="login theme-button">登录</a>\n        </div>\n      </div>\n    `;this.requestedPopup=true;this.init()}get name(){return"userInfo"}async init(){const i=await SpinQuery.select(".custom-navbar .user-info-panel");new Vue({el:i,data:{...c},computed:{userType(){if(!this.isLogin){return"未登录"}if(this.level_info.current_level===0){return"注册会员"}if(this.vipStatus===1){if(this.vipType===1){return this.vip_theme_type?"小会员":"大会员"}else if(this.vipType===2){return this.vip_theme_type?"年度小会员":"年度大会员"}}return"正式会员"},levelProgressStyle(){const i=(this.level_info.current_exp-this.level_info.current_min)/(this.level_info.next_exp-this.level_info.current_min);return{transform:`scaleX(${i})`}}}});const t=await SpinQuery.select(".custom-navbar .user-face-container .user-face");if(c.isLogin){const i=c.face.replace("http","https");const e=68;const a=[1,1.25,1.5,1.75,2,2.25,2.5,2.75,3,3.25,3.5,3.75,4];t.setAttribute("srcset",a.map(t=>{return`${i}@${parseInt(e*t)}w_${parseInt(e*t)}h.jpg ${t}x`}).join(","));if(c.pendant.image){const i=await SpinQuery.select(".custom-navbar .user-face-container .user-pendant");const t=c.pendant.image.replace("http","https");const e=116;i.setAttribute("srcset",a.reduce((i,a)=>{return i+`, ${t}@${parseInt(e*a)}w_${parseInt(e*a)}h.png ${a}x`},""))}}else{t.setAttribute("src","https://static.hdslb.com/images/akari.jpg")}}}class f extends m{constructor(){super();this.disabled=true;this.html=`\n      <form id="custom-navbar-search" autocomplete="off" target="_blank" method="get" action="https://search.bilibili.com/all">\n        <input type="text" placeholder="搜索" name="keyword">\n        <input type="hidden" name="from_source" value="banner_search">\n        <a style="display: none" target="_blank" class="recommended-target"></a>\n        <button type="submit" title="搜索" tabindex="-1">\n          <svg style="width:22px;height:22px" viewBox="0 0 24 24">\n            <path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" />\n          </svg>\n        </button>\n      </form>\n      <div class="popup search-list" :class="{empty: items.length === 0}">\n        <div class="search-list-item" tabindex="0" v-for="(item, index) of items" v-html="item.html" @keydown.enter="submit(item.value)" @click.self="submit(item.value)" @keydown.shift.delete="deleteItem(item, index)" @keydown.down.prevent="nextItem(index)" @keydown.up.prevent="previousItem(index)"></div>\n        <div tabindex="0" v-if="items.length > 0 && isHistory" class="search-list-item clear-history" @click="clearSearchHistory()" @keydown.enter="clearSearchHistory()" @keydown.down.prevent="nextItem(items.length)" @keydown.up.prevent="previousItem(items.length)"><i class="mdi mdi-18px mdi-delete-sweep"></i>清除搜索历史</div>\n      </div>\n    `;this.init()}async init(){const e=await SpinQuery.select("#custom-navbar-search");const a=e.querySelector("input[name='keyword']");e.addEventListener("submit",t=>{if(a.value===""){if(!i.hideTopSearch){e.querySelector(".recommended-target").click()}t.preventDefault();return false}const s=i.searchHistory.find(i=>i.keyword===a.value);if(s){s.count++}else{i.searchHistory.push({count:1,keyword:a.value})}i.searchHistory=i.searchHistory;return true});if(!i.hideTopSearch){const i=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(i.code===0){a.setAttribute("placeholder",i.data.show_name);let t;if(i.data.url!==""){t=i.data.url}else if(i.data.name.startsWith("av")){t=`https://www.bilibili.com/${i.data.name}`}else{t=`https://search.bilibili.com/all?keyword=${i.data.name}`}e.querySelector(".recommended-target").setAttribute("href",t)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const s=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(i){a.value=i;e.submit();raiseEvent(e,"submit")},nextItem(i){const t=dq(`.custom-navbar .search-list-item:nth-child(${i+2})`);if(t){t.focus()}},previousItem(i){const t=dq(`.custom-navbar .search-list-item:nth-child(${i})`);if(t){t.focus()}else{a.focus();return}},deleteItem(t,e){i.searchHistory=i.searchHistory.splice(i.searchHistory.findIndex(i=>i.keyword===t.value),1);this.items.splice(e,1)},clearSearchHistory(){i.searchHistory=[];this.items=[]}}});const{debounce:n}=await t.importAsync("debounce");let l="";const o=async()=>{const t=a.value;s.isHistory=t==="";if(s.isHistory){s.items=i.searchHistory.sort((i,t)=>t.count-i.count).map(i=>{return{value:i.keyword,html:i.keyword}}).slice(0,10)}else{const i=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${c.mid}&bangumi_acc_num=1&special_acc_num=1&topic_acc_num=1&upuser_acc_num=3&tag_num=10&special_num=10&bangumi_num=10&upuser_num=3&term=${t}`;l=i;const e=await Ajax.getJson(i);if(e.code!==0||l!==i){return}const a=e.result.tag;if(a===undefined){s.items=[];return}s.items=a.map(i=>{return{value:i.value,html:i.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};o();const r=n(o,200);let d=false;a.addEventListener("compositionstart",()=>d=true);a.addEventListener("compositionend",()=>{d=false;raiseEvent(a,"input")});a.addEventListener("input",()=>{if(!d){r()}});a.addEventListener("keydown",i=>{if(i.key==="ArrowDown"&&s.items.length>0){i.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}class y extends m{constructor(i,t,{src:e,width:a,height:s,lazy:n,iframeName:l}){super();this.iframeName=l;this.html=i;this.href=t;this.popupHtml=`\n      <iframe src="${e}" frameborder="0" width="${a}" height="${s}"></iframe>\n    `;this.noPadding=true;this.requestedPopup=n?false:true;this.touch=false;this.transparent=true}get name(){return this.iframeName+"Iframe"}}class _ extends y{constructor(...t){super(...t);this.touch=i.touchNavBar;this.getNotifyCount()}getApiUrl(){return null}getCount(){return 0}async getNotifyCount(){const i=await SpinQuery.select(`.custom-navbar li[data-name='${this.name}'] .notify-count`);const t=await Ajax.getJsonWithCredentials(this.getApiUrl());const e=this.getCount(t);if(t.code===0&&e){i.innerHTML=e;this.initialPopup=(()=>{i.innerHTML=""})}}}let k=()=>{};let x=()=>{};const $=({dataObject:i,apiUrl:e,name:a,handleJson:s,template:n})=>{return{template:n,components:{"dpi-img":()=>t.importAsync("dpi-img.vue")},methods:{handleJson:s,async fetchData(i=false){try{const t=await Ajax.getJsonWithCredentials(e);if(t.code!==0){throw new Error(t.message)}await this.handleJson(t)}catch(t){if(i===true){return}logError(`加载${a}动态失败, error = ${t}`)}finally{this.loading=false}}},data(){return Object.assign({loading:true},i)},mounted(){this.fetchData();k=(async()=>await this.fetchData(true))},destroyed(){k=(()=>{})}}};class L extends m{constructor(){super();this.noPadding=true;this.href=i.oldTweets?"https://www.bilibili.com/account/dynamic":"https://t.bilibili.com/";this.html="动态";this.popupHtml=`\n      <div class="activity-popup">\n        <activity-tabs :tab.sync="selectedTab" :items="tabs"></activity-tabs>\n        <div class="activity-popup-content">\n          <transition name="activity-content" mode="out-in">\n            <component :is="content"></component>\n          </transition>\n          \x3c!-- <a class="view-more" target="_blank" :href="viewMoreUrl">查看更多<i class="mdi mdi-dots-horizontal-circle-outline"></i></a> --\x3e\n        </div>\n      </div>\n    `;this.active=document.URL.replace(/\?.*$/,"")==="https://t.bilibili.com/";this.initialPopup=(()=>{this.init()});this.onPopup=(()=>{this.setNotifyCount(0)});this.getNotifyCount();setInterval(async()=>{await this.getNotifyCount();await x();await k()},L.updateInterval)}static get updateInterval(){return 5*60*1e3}static getLatestID(){return document.cookie.replace(new RegExp(`(?:(?:^|.*;\\s*)bp_t_offset_${c.mid}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1")}static setLatestID(i){const t=L.getLatestID();if(L.compareID(i,t)<0){return}document.cookie=`bp_t_offset_${c.mid}=${i};path=/;domain=.bilibili.com;max-age=${60*60*24*30}`}static compareID(i,t){if(i===t){return 0}if(i.length>t.length){return 1}if(t.length>i.length){return-1}return i>t===true?1:-1}static isNewID(i){return L.compareID(i,d)>0}static updateLatestID(i){const[t]=[...i.map(i=>i.id)].sort(L.compareID).reverse();L.setLatestID(t)}async getNotifyCount(){const i=`https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_num?rsp_type=1&uid=${c.mid}&update_num_dy_id=${L.getLatestID()}&type_list=8,64,512`;const t=await Ajax.getJsonWithCredentials(i);if(t.code!==0){return}this.setNotifyCount(t.data.update_num)}async init(){Vue.component("activity-loading",{template:`\n        <div v-if="loading" class="loading">\n          <i class="mdi mdi-18px mdi-loading mdi-spin"></i>加载中...\n        </div>`,props:["loading"]});Vue.component("activity-empty",{template:`\n        <div class="empty">空空如也哦 =￣ω￣=</div>`});this.popupVM=new Vue({el:await SpinQuery.select(".activity-popup"),data:{tabs:[{name:"视频",component:"video-activity",moreUrl:"https://t.bilibili.com/?tab=8",get notifyApi(){return`https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_num?rsp_type=1&uid=${c.mid}&update_num_dy_id=${L.getLatestID()}&type_list=8`},notifyCount:null},{name:"番剧",component:"bangumi-activity",moreUrl:"https://t.bilibili.com/?tab=512",get notifyApi(){return`https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_num?rsp_type=1&uid=${c.mid}&update_num_dy_id=${L.getLatestID()}&type_list=512`},notifyCount:null},{name:"专栏",component:"column-activity",moreUrl:"https://t.bilibili.com/?tab=64",get notifyApi(){return`https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_num?rsp_type=1&uid=${c.mid}&update_num_dy_id=${L.getLatestID()}&type_list=64`},notifyCount:null},{name:"直播",component:"live-activity",moreUrl:"https://link.bilibili.com/p/center/index#/user-center/follow/1",notifyCount:null}],selectedTab:"视频"},components:{"activity-tabs":{props:["items","tab"],template:`\n            <ul class="activity-tabs">\n              <li v-for="item of items" class="activity-tab" :data-count="item.notifyCount" :class="{selected: item.name === tab}" @click="changeTab(item)">\n                <div class="tab-name">{{item.name}}</div>\n              </li>\n              <a class="view-all" target="_blank" href="https://t.bilibili.com/">\n                全部动态\n                <i class="custom-navbar-iconfont-new-home custom-navbar-icon-activity"></i>\n              </a>\n            </ul>\n          `,methods:{changeTab(i){if(this.tab===i.name){window.open(i.moreUrl,"_blank")}this.$emit("update:tab",i.name)}}},"video-activity":Object.assign($({dataObject:{leftCards:[],rightCards:[]},apiUrl:`https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=${c.mid}&type_list=8`,name:"视频",template:`\n            <div class="video-activity" :class="{center: loading || (leftCards.length + rightCards.length) === 0}">\n              <activity-loading :loading="loading"></activity-loading>\n              <activity-empty v-if="!loading && leftCards.length + rightCards.length === 0"></activity-empty>\n              <div v-if="!loading" class="video-activity-column">\n                <video-card v-for="card of leftCards" :key="card.id" :card="card" :watchlaterInit="card.watchlater"></video-card>\n              </div>\n              <div v-if="!loading" class="video-activity-column">\n                <video-card v-for="card of rightCards" :key="card.id" :card="card" :watchlaterInit="card.watchlater"></video-card>\n              </div>\n            </div>\n          `,handleJson:async function(i){const{getWatchlaterList:e}=await t.importAsync("watchlater-api");const a=await e();const s=i.data.cards.map(i=>{const t=JSON.parse(i.card);return{coverUrl:t.pic,title:t.title,timeNumber:t.duration,time:formatDuration(t.duration),description:t.desc,aid:t.aid,videoUrl:`https://www.bilibili.com/av${t.aid}`,faceUrl:i.desc.user_profile.info.face,upName:i.desc.user_profile.info.uname,upUrl:`https://space.bilibili.com/${i.desc.user_profile.info.uid}`,id:i.desc.dynamic_id_str,watchlater:a.includes(t.aid),get new(){return L.isNewID(this.id)}}});this.leftCards=s.filter((i,t)=>t%2===0);this.rightCards=s.filter((i,t)=>t%2===1);if(this.leftCards.length!==this.rightCards.length){this.leftCards.pop()}L.updateLatestID(s)}}),{components:{"video-card":{props:["card","watchlaterInit"],data(){return{watchlater:this.watchlaterInit}},components:{"dpi-img":()=>t.importAsync("dpi-img.vue")},methods:{async toggleWatchlater(){try{this.watchlater=!this.watchlater;const{toggleWatchlater:i}=await t.importAsync("watchlater-api");await i(this.card.aid,this.watchlater)}catch(i){logError(i);this.watchlater=!this.watchlater}}},async mounted(){await t.importAsync("watchlater-api")},template:`\n                <a class="video-activity-card" :class="{new: card.new}" target="_blank" :href="card.videoUrl">\n                  <div class="cover-container">\n                    <dpi-img class="cover" :size="{width: 172}" :src="card.coverUrl"></dpi-img>\n                    <div class="time">{{card.time}}</div>\n                    <div @click.stop.prevent="toggleWatchlater()" class="watchlater"><i class="mdi" :class="{'mdi-clock-outline': !watchlater, 'mdi-check-circle': watchlater}"></i>{{watchlater ? '已添加' : '稍后再看'}}</div>\n                  </div>\n                  <h1 class="title" :title="card.title">{{card.title}}</h1>\n                  <a class="up" target="_blank" :href="card.upUrl" :title="card.upName">\n                    <dpi-img class="face" :size="24" :src="card.faceUrl"></dpi-img>\n                    <span class="name">{{card.upName}}</span>\n                  </a>\n                </a>\n              `}}}),"bangumi-activity":$({dataObject:{cards:[]},apiUrl:`https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=${c.mid}&type_list=512`,name:"番剧",template:`\n            <div class="bangumi-activity" :class="{center: loading || cards.length === 0}">\n              <activity-loading :loading="loading"></activity-loading>\n              <activity-empty v-if="!loading && cards.length === 0"></activity-empty>\n              <a v-if="!loading" class="bangumi-card" :class="{new: card.new}" v-for="card of cards" :key="card.id" target="_blank" :href="card.url">\n                <dpi-img class="ep-cover" :size="{width: 100}" :src="card.epCoverUrl"></dpi-img>\n                <h1 class="ep-title" :title="card.epTitle">{{card.epTitle}}</h1>\n                <div class="up" :title="card.title">\n                  <dpi-img class="cover" :size="24" :src="card.coverUrl"></dpi-img>\n                  <div class="title">{{card.title}}</div>\n                </div>\n              </a>\n            </div>\n          `,handleJson:async function(i){this.cards=i.data.cards.map(i=>{const t=JSON.parse(i.card);return{title:t.apiSeasonInfo.title,coverUrl:t.apiSeasonInfo.cover,epCoverUrl:t.cover,epTitle:t.new_desc,url:t.url,id:i.desc.dynamic_id_str,get new(){return L.isNewID(this.id)}}});L.updateLatestID(this.cards)}}),"column-activity":$({dataObject:{cards:[]},apiUrl:`https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=${c.mid}&type_list=64`,name:"专栏",template:`\n            <div class="column-activity" :class="{center: loading || cards.length === 0}">\n              <activity-loading :loading="loading"></activity-loading>\n              <activity-empty v-if="!loading && cards.length === 0"></activity-empty>\n              <a v-if="!loading" class="column-card" :class="{new: card.new}" v-for="card of cards" :key="card.id" target="_blank" :href="card.url">\n                <div class="covers">\n                  <dpi-img class="cover" v-for="cover of card.covers" :key="cover" :size="{height: 120}" :src="cover"></dpi-img>\n                  <a class="up" target="_blank" :href="card.upUrl">\n                    <dpi-img class="face" :size="24" :src="card.faceUrl"></dpi-img>\n                    <div class="name">{{card.upName}}</div>\n                  </a>\n                </div>\n                <h1 class="title" :title="card.title">{{card.title}}</h1>\n                <div class="description" :title="card.description">{{card.description}}</div>\n              </a>\n            </div>\n          `,handleJson:async function(i){this.cards=i.data.cards.map(i=>{const t=JSON.parse(i.card);return{covers:t.image_urls,originalCovers:t.origin_image_urls,upName:t.author.name,faceUrl:t.author.face,upUrl:`https://space.bilibili.com/${t.author.mid}`,title:t.title,description:t.summary,url:`https://www.bilibili.com/read/cv${t.id}`,id:i.desc.dynamic_id_str,get new(){return L.isNewID(this.id)}}});L.updateLatestID(this.cards)}}),"live-activity":$({dataObject:{cards:[]},apiUrl:`https://api.live.bilibili.com/relation/v1/feed/feed_list?page=1&pagesize=24`,name:"直播",template:`\n            <div class="live-activity" :class="{center: loading || cards.length === 0}">\n              <activity-loading :loading="loading"></activity-loading>\n              <activity-empty v-if="!loading && cards.length === 0"></activity-empty>\n              <a v-if="!loading" class="live-card" v-for="card of cards" :key="card.id" target="_blank" :href="card.url">\n                <dpi-img class="face" :size="{width: 48}" :src="card.faceUrl"></dpi-img>\n                <h1 class="live-title" :title="card.title">{{card.title}}</h1>\n                <div class="name" :title="card.name">{{card.name}}</div>\n              </a>\n            </div>\n          `,handleJson:async function(i){this.cards=i.data.list.map(i=>{return{faceUrl:i.face,title:i.title,name:i.uname,id:i.roomid,url:i.link}})}})},computed:{content(){return this.tabs.find(i=>i.name===this.selectedTab).component},viewMoreUrl(){return this.tabs.find(i=>i.name===this.selectedTab).moreUrl}},mounted(){x=(async()=>{for(const i of this.tabs){if(i.notifyApi){const t=await Ajax.getJsonWithCredentials(i.notifyApi);if(t.code!==0||!t.data.update_num||this.selectedTab===i.name){continue}i.notifyCount=t.data.update_num}}});x()},destroyed(){x=(()=>{})},watch:{selectedTab(i){this.tabs.find(t=>t.name===i).notifyCount=null}}})}get name(){return"activities"}}class C extends m{constructor({mainUrl:i,name:t,apiUrl:e,listName:a,listMap:s}){super();this.href=i;this.listName=a;this.html=t;this.noPadding=true;this.requestedPopup=false;this.popupHtml=`\n      <ol class="video-list ${a}">\n          <li class="loading">加载中...</li>\n      </ol>\n    `;this.initialPopup=(async()=>{if(!s){return}const n=await SpinQuery.select(`.video-list.${a}`);if(n===null){return}const l=await Ajax.getJsonWithCredentials(e);let o="";if(l.code!==0){logError(`加载${t}信息失败. 错误码: ${l.code} ${l.message}`)}else{o=s(l).join("")}n.insertAdjacentHTML("beforeend",o+`\n        <li class="more"><a target="_blank" href="${i}">查看更多</a></li>\n      `);n.classList.add("loaded")})}get name(){return this.listName+"List"}}class N extends C{constructor(){super({name:"稍后再看",mainUrl:"https://www.bilibili.com/watchlater/#/list",apiUrl:"https://api.bilibili.com/x/v2/history/toview/web",listName:"watchlater",listMap:t=>{if(!t.data.list){return[`<li class="loading empty">空空如也哦 =￣ω￣=</li>`]}return t.data.list.slice(0,6).map(t=>{const e=(()=>{if(t.pages===undefined){return i.watchLaterRedirect?`https://www.bilibili.com/video/av${t.aid}`:`https://www.bilibili.com/watchlater/#/av${t.aid}`}const e=t.pages.map(i=>i.cid);const a=t.cid===0?1:e.indexOf(t.cid)+1;return i.watchLaterRedirect?`https://www.bilibili.com/video/av${t.aid}?p=${a}`:`https://www.bilibili.com/watchlater/#/av${t.aid}/p${a}`})();return`<li><a target="_blank" href="${e}">${t.title}</a></li>`})}});this.active=document.URL.startsWith("https://www.bilibili.com/watchlater/")}}class I extends C{constructor(){super({name:"收藏",mainUrl:`https://space.bilibili.com/${c.mid}/favlist`,apiUrl:"https://api.bilibili.com/medialist/gateway/coll/resource/recent",listName:"favorites",listMap:i=>{if(!i.data||i.data.length===0){return[`<li class="loading empty">空空如也哦 =￣ω￣=</li>`]}return i.data.map(i=>{return`\n            <li>\n              <a target="_blank" href="https://www.bilibili.com/video/av${i.id}">${i.title}</a>\n            </li>`})}});this.active=document.URL.replace(/\?.*$/,"")===`https://space.bilibili.com/${c.mid}/favlist`}}class A extends C{constructor(){super({name:"历史",mainUrl:"https://www.bilibili.com/account/history",apiUrl:"https://api.bilibili.com/x/v2/history?pn=1&ps=6",listName:"history",listMap:i=>{if(!i.data||i.data.length===0){return[`<li class="loading empty">空空如也哦 =￣ω￣=</li>`]}return i.data.map(i=>{let t=[];let e="";const a=i.page?i.page.page:1;let s=i.progress>=0?i.progress/i.duration:1;if(isNaN(s)){s=0}if(a!==1){t.push(`p=${a}`);e+=`看到第${a}话`}if(i.progress>0&&i.progress<i.duration){t.push(`t=${i.progress}`);e+=` ${Math.floor(s*100)}%`}else if(i.progress===0){e+=` 刚开始看`}else{e+=" 100%"}return`\n            <li class="history-item">\n              <a target="_blank" href="https://www.bilibili.com/video/av${i.aid}?${t.join("&")}">\n                <span class="title">${i.title}</span>\n                <span class="description">${e}</span>\n                <div class="progress background">\n                  <div class="progress foreground" style="--progress: ${s*100}%"></div>\n                </div>\n              </a>\n            </li>`})}});this.active=document.URL.replace(/\?.*$/,"")==="https://www.bilibili.com/account/history"}}class S extends m{constructor(){super();this.noPadding=true;this.href=`https://space.bilibili.com/${c.mid}/bangumi`;this.html="订阅";this.active=[`https://space.bilibili.com/${c.mid}/bangumi`,`https://space.bilibili.com/${c.mid}/cinema`,`https://space.bilibili.com/${c.mid}/subs`].includes(document.URL.replace(/\?.*$/,""));this.popupHtml=`\n    <div class="subscriptions">\n      <ul class="subscriptions-tabs">\n        <li class="tab" :class="{selected: bangumi}" @click="bangumi = true">追番</li>\n        <li class="tab" :class="{selected: !bangumi}" @click="bangumi = false">追剧</li>\n        <div class="tab-placeholder"></div>\n        <a class="view-all" target="_blank" :href="'https://space.bilibili.com/${c.mid}/' + (bangumi ? 'bangumi' : 'cinema')">\n          查看更多\n          <i class="mdi mdi-dots-horizontal-circle-outline"></i>\n        </a>\n      </ul>\n      <div class="content">\n        <transition name="subscriptions-content" mode="out-in">\n          <bangumi-subscriptions v-if="bangumi" type="bangumi" :key="'bangumi'"></bangumi-subscriptions>\n          <bangumi-subscriptions v-else type="cinema" :key="'cinema'"></bangumi-subscriptions>\n        </transition>\n      </div>\n    </div>`;this.initialPopup=(()=>{this.init()})}async init(){new Vue({el:await SpinQuery.select(".custom-navbar .subscriptions"),data:{bangumi:true},components:{"bangumi-subscriptions":{props:["type"],components:{"dpi-img":()=>t.importAsync("dpi-img.vue")},template:`\n            <div class="bangumi-subscriptions" :class="{center: loading || !loading && cards.length === 0}">\n              <div v-if="loading" class="loading">\n                <i class="mdi mdi-18px mdi-loading mdi-spin"></i>\n                加载中...\n              </div>\n              <div v-if="!loading && cards.length === 0" class="empty">空空如也哦 =￣ω￣=</div>\n              <a v-if="!loading" v-for="card of cards" :key="card.id" :href="card.playUrl" target="_blank" class="bangumi-subscriptions-card">\n                <dpi-img class="cover" :src="card.coverUrl" :size="{height: 64}"></dpi-img>\n                <div class="card-info">\n                  <h1 class="title" :title="card.title">{{card.title}}</h1>\n                  <div class="progress-row">\n                    <div v-if="card.progress" class="progress" :title="card.progress + ' | ' + card.latest">{{card.progress}} | {{card.latest}}</div>\n                    <div v-else class="progress" :title="card.latest">{{card.latest}}</div>\n                    <a class="info" :href="card.mediaUrl" target="_blank" title="详细信息">\n                      <i class="mdi mdi-information-outline"></i>\n                    </a>\n                  </div>\n                </div>\n              </a>\n            </div>\n          `,data(){return{loading:true,cards:[]}},async mounted(){try{const i=await Ajax.getJsonWithCredentials(`https://api.bilibili.com/x/space/bangumi/follow/list?type=${this.type!=="bangumi"?"2":"1"}&pn=1&ps=16&vmid=${c.mid}`);if(i.code!==0){logError(`加载订阅信息失败: ${i.message}`);return}this.cards=i.data.list.map(i=>{return{title:i.title,coverUrl:i.square_cover.replace("http:","https:"),latest:i.new_ep.index_show,progress:i.progress,id:i.season_id,playUrl:`https://www.bilibili.com/bangumi/play/ss${i.season_id}`,mediaUrl:`https://www.bilibili.com/bangumi/media/md${i.media_id}`}})}finally{this.loading=false}}}}})}get name(){return"bangumi"}}(async()=>{const e=await t.importAsync("customNavbarHtml");const a=await Ajax.getJsonWithCredentials("https://api.bilibili.com/x/web-interface/nav");c=a.data;d=L.getLatestID();document.body.insertAdjacentHTML("beforeend",e);addSettingsListener("useDarkStyle",n);n(i.useDarkStyle);["Fill","Shadow","Compact","Blur"].forEach(t=>{addSettingsListener("customNavbar"+t,i=>s(t.toLowerCase(),i,document.querySelector(".custom-navbar")));s(t.toLowerCase(),i["customNavbar"+t],document.querySelector(".custom-navbar"))});SpinQuery.condition(()=>dq("#banner_link,.international-header .bili-banner"),i=>i===null?null:i.style.backgroundImage,i=>{Observer.attributes(i,()=>{const t=document.querySelectorAll(".custom-navbar .blur-layer");t.forEach(t=>{t.style.backgroundImage=i.style.backgroundImage;t.setAttribute("data-image",i.style.backgroundImage)})})});const l=[new u(1),new p,new w,new b("排行","https://www.bilibili.com/ranking","ranking"),new b("相簿","https://h.bilibili.com","drawing"),new b("音频","https://www.bilibili.com/audio/home/","music"),new y("游戏中心","https://game.bilibili.com/",{src:`https://www.bilibili.com/page-proxy/game-nav.html`,width:`680px`,height:`260px`,lazy:true,iframeName:"games"}),new y("直播","https://live.bilibili.com",{src:`https://live.bilibili.com/blackboard/dropdown-menu.html`,width:`528px`,height:`266px`,lazy:true,iframeName:"lives"}),new b("会员购","https://show.bilibili.com","shop"),new b("漫画","https://manga.bilibili.com","manga"),new u(2),new f,new g];if(c.isLogin){l.push(new v,new S,new L,new N,new I,new A)}l.push(new h,new u(3));new Vue({el:".custom-navbar",data:{components:l},methods:{requestPopup(i){if(!i.requestedPopup&&!i.disabled&&!i.active){this.$set(i,`requestedPopup`,true);i.initialPopup&&i.initialPopup()}i.onPopup&&i.onPopup()}},mounted(){document.body.classList.remove("custom-navbar-loading")}})})();return a}})();