From 293b968b1345dc0c129c88c4c75af44c8e46aea1 Mon Sep 17 00:00:00 2001 From: the1812 Date: Mon, 23 Mar 2020 15:46:19 +0800 Subject: [PATCH] Add bv jump --- bilibili-evolved.offline.user.js | 4 ++-- bilibili-evolved.preview-offline.user.js | 4 ++-- bilibili-evolved.preview.user.js | 2 +- bilibili-evolved.user.js | 2 +- min/bundle.json | 2 +- min/bundle.zip | Bin 1711435 -> 1711585 bytes min/custom-navbar-search-box.min.js | 2 +- .../simple/custom-navbar-search-box.ts | 5 +++++ 8 files changed, 13 insertions(+), 8 deletions(-) diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js index 5f7d0be3b..64f1e6c2d 100644 --- a/bilibili-evolved.offline.user.js +++ b/bilibili-evolved.offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Offline) -// @version 615.78 +// @version 615.98 // @description Bilibili Evolved 的离线版, 所有功能都已内置于脚本中. // @author Grant Howard, Coulomb-G // @copyright 2020, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) @@ -1227,7 +1227,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-iframe.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:r}=e.import("custom-navbar-component");class s extends r{constructor(t,e,r){super();const{src:s,width:a,height:i,lazy:n,iframeName:h}=r;this.boundingWidth=parseInt(a);this.iframeName=h;this.html=t;this.href=e;this.popupHtml=`\n\n`;this.noPadding=true;this.requestedPopup=n?false:true;this.touch=false;this.transparent=true}get name(){return this.iframeName+"Iframe"}}return{export:{Iframe:s}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-logo.min.js"] = (()=>{return(t,o)=>{const{NavbarComponent:s}=o.import("custom-navbar-component");class e extends s{constructor(){super();this.href=`https://www.bilibili.com/`;this.touch=false;addSettingsListener("customNavbarSeasonLogo",()=>this.getLogo(),true)}async getLogo(){if(t.customNavbarSeasonLogo){const t=await Ajax.getJson("https://api.bilibili.com/x/web-show/res/locs?pf=0&ids=142");if(t.code===0){this.html=``;return}}this.html=``}get name(){return"logo"}}return{export:{Logo:e}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-messages.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:a}=e.import("custom-navbar-component");class i extends a{constructor(){super();this.href="https://message.bilibili.com/";this.html="消息";this.popupHtml=`\n\n`;this.requestedPopup=true;this.active=document.URL.startsWith("https://message.bilibili.com/");this.fetchSettings().then(t=>{if(t){this.init()}})}get name(){return"messages"}async fetchSettings(){const t=await Ajax.getJsonWithCredentials(`https://api.vc.bilibili.com/link_setting/v1/link_setting/get?msg_notify=1`);if(t.code!==0){return}await this.setNotifyStyle(t.data.msg_notify);return t.data.msg_notify!==3}async init(){const t=await Ajax.getJsonWithCredentials(`https://api.bilibili.com/x/msgfeed/unread`);const e=await Ajax.getJsonWithCredentials(`https://api.vc.bilibili.com/session_svr/v1/session_svr/single_unread`);const a=await SpinQuery.select("#message-list");const i=[...a.querySelectorAll("a[data-name]")];const s=i.map(t=>t.getAttribute("data-name"));if(t.code!==0||e.code!==0){return}t.data["user_msg"]=e.data.unfollow_unread+e.data.follow_unread;let n=s.reduce((e,a)=>e+t.data[a],0);if(!n){return}await this.setNotifyCount(n);s.forEach((e,a)=>{const s=t.data[e];if(s>0){i[a].setAttribute("data-count",s.toString())}else{i[a].removeAttribute("data-count")}});i.forEach(t=>{t.addEventListener("click",()=>{const e=parseInt(t.getAttribute("data-count"));t.removeAttribute("data-count");n-=e;this.setNotifyCount(n)})})}}return{export:{Messages:i}}}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-search-box.min.js"] = (()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-search-box.min.js"] = (()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}if(/^bv[\da-zA-Z]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.replace(/^bv/i,"BV")}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-settings.min.js"] = (()=>{return(e,t)=>{const s=async()=>{await SpinQuery.select(".custom-navbar-settings");const{Slip:s}=await t.importAsync("slip");const r=dq("#custom-navbar-settings");r.addEventListener("click",async()=>{const e=dq(".custom-navbar-settings");if(e){e.classList.toggle("show");dq(".gui-settings-mask").click()}});r.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
  • \n\n {{item.displayName}}\n\n
  • \n`,methods:{hidden(){return e.customNavbarHidden.includes(this.item.name)},viewBorder(e){const t=dq(`.custom-navbar li[data-name='${this.item.name}']`);if(t!==null){t.classList.toggle("view-border",e)}},toggleHidden(){const t=this.hidden();if(t===false){e.customNavbarHidden.push(this.item.name)}else{const t=e.customNavbarHidden.indexOf(this.item.name);if(t===-1){return}e.customNavbarHidden.splice(t,1)}this.$forceUpdate();const s=dq(`.custom-navbar li[data-name='${this.item.name}']`);if(s!==null){s.style.display=t?"flex":"none"}e.customNavbarHidden=e.customNavbarHidden}}});const r=_.debounce(t=>{document.body.style.setProperty("--navbar-bounds-padding",`0 ${t}%`);e.customNavbarBoundsPadding=t},200);new Vue({el:".custom-navbar-settings",mounted(){const t=dq(".custom-navbar-settings .order-list");const r=({sourceItem:s,targetItem:r,orderBefore:a,orderAfter:n})=>{if(a===n){return}const i=Object.entries(e.customNavbarOrder).filter(([e])=>e in customNavbarDefaultOrders);const o=i.sort((e,t)=>e[1]-t[1]).map(e=>e[0]);if(a=n;t--){const s=o[t];e.customNavbarOrder[s]=t+1;const r=dq(`.custom-navbar li[data-name='${s}']`);r.style.order=(t+1).toString()}}e.customNavbarOrder[o[a]]=n;const d=dq(`.custom-navbar li[data-name='${o[a]}']`);d.style.order=n.toString();t.insertBefore(s,r);e.customNavbarOrder=e.customNavbarOrder};new s(t);t.addEventListener("slip:beforewait",e=>{if(e.target.classList.contains("mdi-menu")){e.preventDefault()}},false);t.addEventListener("slip:beforeswipe",e=>e.preventDefault(),false);t.addEventListener("slip:reorder",e=>{r({sourceItem:e.target,targetItem:e.detail.insertBefore,orderBefore:e.detail.originalIndex,orderAfter:e.detail.spliceIndex});return false},false)},computed:{orderList(){const s=Object.entries(e.customNavbarOrder);return s.filter(e=>e[0]in t).sort((e,t)=>e[1]-t[1]).map(e=>{return{displayName:t[e[0]],name:e[0],order:e[1]}})}},data:{boundsPadding:e.customNavbarBoundsPadding},watch:{boundsPadding(e){r(e)}},methods:{close(){dq(".custom-navbar-settings").classList.remove("show")},restoreDefault(){if(typeof customNavbarDefaultOrders==="undefined"){Toast.error("未找到默认值设定, 请更新您的脚本.","自定义顶栏",3e3);return}if(confirm("确定要恢复默认顶栏布局吗? 恢复后页面将刷新.")){this.boundsPadding=5;e.customNavbarOrder=customNavbarDefaultOrders;location.reload()}}}})},{once:true})};return{export:{initSettingsPanel:s}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-simple-link.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:n}=e.import("custom-navbar-component");class s extends n{constructor(t,e,n){super();this.linkName=n;this.html=t;this.href=e;this.touch=false;this.active=document.URL.startsWith(e)}get name(){return this.linkName+"Link"}}return{export:{SimpleLink:s}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-subscriptions.min.js"] = (()=>{return(i,s)=>{const{NavbarComponent:a}=s.import("custom-navbar-component");class t extends a{constructor(){super();this.boundingWidth=380;this.noPadding=true;const i=getUID();this.href=`https://space.bilibili.com/${i}/bangumi`;this.html="订阅";this.active=[`https://space.bilibili.com/${i}/bangumi`,`https://space.bilibili.com/${i}/cinema`,`https://space.bilibili.com/${i}/subs`].includes(document.URL.replace(/\?.*$/,""));this.popupHtml=`\n
    \n\n
    \n\n\n\n\n
    \n
    `;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":()=>s.importAsync("dpi-img.vue")},template:`\n
    \n
    \n\n 加载中...\n
    \n
    空空如也哦 = ̄ω ̄=
    \n\n\n\n\n
    \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=${getUID()}`);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"}}return{export:{Subscriptions:t}}}})(); diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js index 9043a1062..824a8a84b 100644 --- a/bilibili-evolved.preview-offline.user.js +++ b/bilibili-evolved.preview-offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Preview Offline) -// @version 615.78 +// @version 615.98 // @description Bilibili Evolved 的预览离线版, 可以抢先体验新功能, 并且所有功能都已内置于脚本中. // @author Grant Howard, Coulomb-G // @copyright 2020, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) @@ -1227,7 +1227,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-iframe.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:r}=e.import("custom-navbar-component");class s extends r{constructor(t,e,r){super();const{src:s,width:a,height:i,lazy:n,iframeName:h}=r;this.boundingWidth=parseInt(a);this.iframeName=h;this.html=t;this.href=e;this.popupHtml=`\n\n`;this.noPadding=true;this.requestedPopup=n?false:true;this.touch=false;this.transparent=true}get name(){return this.iframeName+"Iframe"}}return{export:{Iframe:s}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-logo.min.js"] = (()=>{return(t,o)=>{const{NavbarComponent:s}=o.import("custom-navbar-component");class e extends s{constructor(){super();this.href=`https://www.bilibili.com/`;this.touch=false;addSettingsListener("customNavbarSeasonLogo",()=>this.getLogo(),true)}async getLogo(){if(t.customNavbarSeasonLogo){const t=await Ajax.getJson("https://api.bilibili.com/x/web-show/res/locs?pf=0&ids=142");if(t.code===0){this.html=``;return}}this.html=``}get name(){return"logo"}}return{export:{Logo:e}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-messages.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:a}=e.import("custom-navbar-component");class i extends a{constructor(){super();this.href="https://message.bilibili.com/";this.html="消息";this.popupHtml=`\n\n`;this.requestedPopup=true;this.active=document.URL.startsWith("https://message.bilibili.com/");this.fetchSettings().then(t=>{if(t){this.init()}})}get name(){return"messages"}async fetchSettings(){const t=await Ajax.getJsonWithCredentials(`https://api.vc.bilibili.com/link_setting/v1/link_setting/get?msg_notify=1`);if(t.code!==0){return}await this.setNotifyStyle(t.data.msg_notify);return t.data.msg_notify!==3}async init(){const t=await Ajax.getJsonWithCredentials(`https://api.bilibili.com/x/msgfeed/unread`);const e=await Ajax.getJsonWithCredentials(`https://api.vc.bilibili.com/session_svr/v1/session_svr/single_unread`);const a=await SpinQuery.select("#message-list");const i=[...a.querySelectorAll("a[data-name]")];const s=i.map(t=>t.getAttribute("data-name"));if(t.code!==0||e.code!==0){return}t.data["user_msg"]=e.data.unfollow_unread+e.data.follow_unread;let n=s.reduce((e,a)=>e+t.data[a],0);if(!n){return}await this.setNotifyCount(n);s.forEach((e,a)=>{const s=t.data[e];if(s>0){i[a].setAttribute("data-count",s.toString())}else{i[a].removeAttribute("data-count")}});i.forEach(t=>{t.addEventListener("click",()=>{const e=parseInt(t.getAttribute("data-count"));t.removeAttribute("data-count");n-=e;this.setNotifyCount(n)})})}}return{export:{Messages:i}}}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-search-box.min.js"] = (()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-search-box.min.js"] = (()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}if(/^bv[\da-zA-Z]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.replace(/^bv/i,"BV")}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-settings.min.js"] = (()=>{return(e,t)=>{const s=async()=>{await SpinQuery.select(".custom-navbar-settings");const{Slip:s}=await t.importAsync("slip");const r=dq("#custom-navbar-settings");r.addEventListener("click",async()=>{const e=dq(".custom-navbar-settings");if(e){e.classList.toggle("show");dq(".gui-settings-mask").click()}});r.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
  • \n\n {{item.displayName}}\n\n
  • \n`,methods:{hidden(){return e.customNavbarHidden.includes(this.item.name)},viewBorder(e){const t=dq(`.custom-navbar li[data-name='${this.item.name}']`);if(t!==null){t.classList.toggle("view-border",e)}},toggleHidden(){const t=this.hidden();if(t===false){e.customNavbarHidden.push(this.item.name)}else{const t=e.customNavbarHidden.indexOf(this.item.name);if(t===-1){return}e.customNavbarHidden.splice(t,1)}this.$forceUpdate();const s=dq(`.custom-navbar li[data-name='${this.item.name}']`);if(s!==null){s.style.display=t?"flex":"none"}e.customNavbarHidden=e.customNavbarHidden}}});const r=_.debounce(t=>{document.body.style.setProperty("--navbar-bounds-padding",`0 ${t}%`);e.customNavbarBoundsPadding=t},200);new Vue({el:".custom-navbar-settings",mounted(){const t=dq(".custom-navbar-settings .order-list");const r=({sourceItem:s,targetItem:r,orderBefore:a,orderAfter:n})=>{if(a===n){return}const i=Object.entries(e.customNavbarOrder).filter(([e])=>e in customNavbarDefaultOrders);const o=i.sort((e,t)=>e[1]-t[1]).map(e=>e[0]);if(a=n;t--){const s=o[t];e.customNavbarOrder[s]=t+1;const r=dq(`.custom-navbar li[data-name='${s}']`);r.style.order=(t+1).toString()}}e.customNavbarOrder[o[a]]=n;const d=dq(`.custom-navbar li[data-name='${o[a]}']`);d.style.order=n.toString();t.insertBefore(s,r);e.customNavbarOrder=e.customNavbarOrder};new s(t);t.addEventListener("slip:beforewait",e=>{if(e.target.classList.contains("mdi-menu")){e.preventDefault()}},false);t.addEventListener("slip:beforeswipe",e=>e.preventDefault(),false);t.addEventListener("slip:reorder",e=>{r({sourceItem:e.target,targetItem:e.detail.insertBefore,orderBefore:e.detail.originalIndex,orderAfter:e.detail.spliceIndex});return false},false)},computed:{orderList(){const s=Object.entries(e.customNavbarOrder);return s.filter(e=>e[0]in t).sort((e,t)=>e[1]-t[1]).map(e=>{return{displayName:t[e[0]],name:e[0],order:e[1]}})}},data:{boundsPadding:e.customNavbarBoundsPadding},watch:{boundsPadding(e){r(e)}},methods:{close(){dq(".custom-navbar-settings").classList.remove("show")},restoreDefault(){if(typeof customNavbarDefaultOrders==="undefined"){Toast.error("未找到默认值设定, 请更新您的脚本.","自定义顶栏",3e3);return}if(confirm("确定要恢复默认顶栏布局吗? 恢复后页面将刷新.")){this.boundsPadding=5;e.customNavbarOrder=customNavbarDefaultOrders;location.reload()}}}})},{once:true})};return{export:{initSettingsPanel:s}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-simple-link.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:n}=e.import("custom-navbar-component");class s extends n{constructor(t,e,n){super();this.linkName=n;this.html=t;this.href=e;this.touch=false;this.active=document.URL.startsWith(e)}get name(){return this.linkName+"Link"}}return{export:{SimpleLink:s}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-subscriptions.min.js"] = (()=>{return(i,s)=>{const{NavbarComponent:a}=s.import("custom-navbar-component");class t extends a{constructor(){super();this.boundingWidth=380;this.noPadding=true;const i=getUID();this.href=`https://space.bilibili.com/${i}/bangumi`;this.html="订阅";this.active=[`https://space.bilibili.com/${i}/bangumi`,`https://space.bilibili.com/${i}/cinema`,`https://space.bilibili.com/${i}/subs`].includes(document.URL.replace(/\?.*$/,""));this.popupHtml=`\n
    \n\n
    \n\n\n\n\n
    \n
    `;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":()=>s.importAsync("dpi-img.vue")},template:`\n
    \n
    \n\n 加载中...\n
    \n
    空空如也哦 = ̄ω ̄=
    \n\n\n\n\n
    \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=${getUID()}`);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"}}return{export:{Subscriptions:t}}}})(); diff --git a/bilibili-evolved.preview.user.js b/bilibili-evolved.preview.user.js index d757e9090..612cd183f 100644 --- a/bilibili-evolved.preview.user.js +++ b/bilibili-evolved.preview.user.js @@ -1226,7 +1226,7 @@ onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/m onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/custom-navbar-iframe.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:r}=e.import("custom-navbar-component");class s extends r{constructor(t,e,r){super();const{src:s,width:a,height:i,lazy:n,iframeName:h}=r;this.boundingWidth=parseInt(a);this.iframeName=h;this.html=t;this.href=e;this.popupHtml=`\n\n`;this.noPadding=true;this.requestedPopup=n?false:true;this.touch=false;this.transparent=true}get name(){return this.iframeName+"Iframe"}}return{export:{Iframe:s}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/custom-navbar-logo.min.js"] = (()=>{return(t,o)=>{const{NavbarComponent:s}=o.import("custom-navbar-component");class e extends s{constructor(){super();this.href=`https://www.bilibili.com/`;this.touch=false;addSettingsListener("customNavbarSeasonLogo",()=>this.getLogo(),true)}async getLogo(){if(t.customNavbarSeasonLogo){const t=await Ajax.getJson("https://api.bilibili.com/x/web-show/res/locs?pf=0&ids=142");if(t.code===0){this.html=``;return}}this.html=``}get name(){return"logo"}}return{export:{Logo:e}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/custom-navbar-messages.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:a}=e.import("custom-navbar-component");class i extends a{constructor(){super();this.href="https://message.bilibili.com/";this.html="消息";this.popupHtml=`\n\n`;this.requestedPopup=true;this.active=document.URL.startsWith("https://message.bilibili.com/");this.fetchSettings().then(t=>{if(t){this.init()}})}get name(){return"messages"}async fetchSettings(){const t=await Ajax.getJsonWithCredentials(`https://api.vc.bilibili.com/link_setting/v1/link_setting/get?msg_notify=1`);if(t.code!==0){return}await this.setNotifyStyle(t.data.msg_notify);return t.data.msg_notify!==3}async init(){const t=await Ajax.getJsonWithCredentials(`https://api.bilibili.com/x/msgfeed/unread`);const e=await Ajax.getJsonWithCredentials(`https://api.vc.bilibili.com/session_svr/v1/session_svr/single_unread`);const a=await SpinQuery.select("#message-list");const i=[...a.querySelectorAll("a[data-name]")];const s=i.map(t=>t.getAttribute("data-name"));if(t.code!==0||e.code!==0){return}t.data["user_msg"]=e.data.unfollow_unread+e.data.follow_unread;let n=s.reduce((e,a)=>e+t.data[a],0);if(!n){return}await this.setNotifyCount(n);s.forEach((e,a)=>{const s=t.data[e];if(s>0){i[a].setAttribute("data-count",s.toString())}else{i[a].removeAttribute("data-count")}});i.forEach(t=>{t.addEventListener("click",()=>{const e=parseInt(t.getAttribute("data-count"));t.removeAttribute("data-count");n-=e;this.setNotifyCount(n)})})}}return{export:{Messages:i}}}})(); -onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/custom-navbar-search-box.min.js"] = (()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); +onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/custom-navbar-search-box.min.js"] = (()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}if(/^bv[\da-zA-Z]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.replace(/^bv/i,"BV")}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/custom-navbar-settings.min.js"] = (()=>{return(e,t)=>{const s=async()=>{await SpinQuery.select(".custom-navbar-settings");const{Slip:s}=await t.importAsync("slip");const r=dq("#custom-navbar-settings");r.addEventListener("click",async()=>{const e=dq(".custom-navbar-settings");if(e){e.classList.toggle("show");dq(".gui-settings-mask").click()}});r.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
  • \n\n {{item.displayName}}\n\n
  • \n`,methods:{hidden(){return e.customNavbarHidden.includes(this.item.name)},viewBorder(e){const t=dq(`.custom-navbar li[data-name='${this.item.name}']`);if(t!==null){t.classList.toggle("view-border",e)}},toggleHidden(){const t=this.hidden();if(t===false){e.customNavbarHidden.push(this.item.name)}else{const t=e.customNavbarHidden.indexOf(this.item.name);if(t===-1){return}e.customNavbarHidden.splice(t,1)}this.$forceUpdate();const s=dq(`.custom-navbar li[data-name='${this.item.name}']`);if(s!==null){s.style.display=t?"flex":"none"}e.customNavbarHidden=e.customNavbarHidden}}});const r=_.debounce(t=>{document.body.style.setProperty("--navbar-bounds-padding",`0 ${t}%`);e.customNavbarBoundsPadding=t},200);new Vue({el:".custom-navbar-settings",mounted(){const t=dq(".custom-navbar-settings .order-list");const r=({sourceItem:s,targetItem:r,orderBefore:a,orderAfter:n})=>{if(a===n){return}const i=Object.entries(e.customNavbarOrder).filter(([e])=>e in customNavbarDefaultOrders);const o=i.sort((e,t)=>e[1]-t[1]).map(e=>e[0]);if(a=n;t--){const s=o[t];e.customNavbarOrder[s]=t+1;const r=dq(`.custom-navbar li[data-name='${s}']`);r.style.order=(t+1).toString()}}e.customNavbarOrder[o[a]]=n;const d=dq(`.custom-navbar li[data-name='${o[a]}']`);d.style.order=n.toString();t.insertBefore(s,r);e.customNavbarOrder=e.customNavbarOrder};new s(t);t.addEventListener("slip:beforewait",e=>{if(e.target.classList.contains("mdi-menu")){e.preventDefault()}},false);t.addEventListener("slip:beforeswipe",e=>e.preventDefault(),false);t.addEventListener("slip:reorder",e=>{r({sourceItem:e.target,targetItem:e.detail.insertBefore,orderBefore:e.detail.originalIndex,orderAfter:e.detail.spliceIndex});return false},false)},computed:{orderList(){const s=Object.entries(e.customNavbarOrder);return s.filter(e=>e[0]in t).sort((e,t)=>e[1]-t[1]).map(e=>{return{displayName:t[e[0]],name:e[0],order:e[1]}})}},data:{boundsPadding:e.customNavbarBoundsPadding},watch:{boundsPadding(e){r(e)}},methods:{close(){dq(".custom-navbar-settings").classList.remove("show")},restoreDefault(){if(typeof customNavbarDefaultOrders==="undefined"){Toast.error("未找到默认值设定, 请更新您的脚本.","自定义顶栏",3e3);return}if(confirm("确定要恢复默认顶栏布局吗? 恢复后页面将刷新.")){this.boundsPadding=5;e.customNavbarOrder=customNavbarDefaultOrders;location.reload()}}}})},{once:true})};return{export:{initSettingsPanel:s}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/custom-navbar-simple-link.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:n}=e.import("custom-navbar-component");class s extends n{constructor(t,e,n){super();this.linkName=n;this.html=t;this.href=e;this.touch=false;this.active=document.URL.startsWith(e)}get name(){return this.linkName+"Link"}}return{export:{SimpleLink:s}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/custom-navbar-subscriptions.min.js"] = (()=>{return(i,s)=>{const{NavbarComponent:a}=s.import("custom-navbar-component");class t extends a{constructor(){super();this.boundingWidth=380;this.noPadding=true;const i=getUID();this.href=`https://space.bilibili.com/${i}/bangumi`;this.html="订阅";this.active=[`https://space.bilibili.com/${i}/bangumi`,`https://space.bilibili.com/${i}/cinema`,`https://space.bilibili.com/${i}/subs`].includes(document.URL.replace(/\?.*$/,""));this.popupHtml=`\n
    \n\n
    \n\n\n\n\n
    \n
    `;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":()=>s.importAsync("dpi-img.vue")},template:`\n
    \n
    \n\n 加载中...\n
    \n
    空空如也哦 = ̄ω ̄=
    \n\n\n\n\n
    \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=${getUID()}`);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"}}return{export:{Subscriptions:t}}}})(); diff --git a/bilibili-evolved.user.js b/bilibili-evolved.user.js index 7c6c6b0ff..ffd2b03d1 100644 --- a/bilibili-evolved.user.js +++ b/bilibili-evolved.user.js @@ -1226,7 +1226,7 @@ onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/mi onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-iframe.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:r}=e.import("custom-navbar-component");class s extends r{constructor(t,e,r){super();const{src:s,width:a,height:i,lazy:n,iframeName:h}=r;this.boundingWidth=parseInt(a);this.iframeName=h;this.html=t;this.href=e;this.popupHtml=`\n\n`;this.noPadding=true;this.requestedPopup=n?false:true;this.touch=false;this.transparent=true}get name(){return this.iframeName+"Iframe"}}return{export:{Iframe:s}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-logo.min.js"] = (()=>{return(t,o)=>{const{NavbarComponent:s}=o.import("custom-navbar-component");class e extends s{constructor(){super();this.href=`https://www.bilibili.com/`;this.touch=false;addSettingsListener("customNavbarSeasonLogo",()=>this.getLogo(),true)}async getLogo(){if(t.customNavbarSeasonLogo){const t=await Ajax.getJson("https://api.bilibili.com/x/web-show/res/locs?pf=0&ids=142");if(t.code===0){this.html=``;return}}this.html=``}get name(){return"logo"}}return{export:{Logo:e}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-messages.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:a}=e.import("custom-navbar-component");class i extends a{constructor(){super();this.href="https://message.bilibili.com/";this.html="消息";this.popupHtml=`\n\n`;this.requestedPopup=true;this.active=document.URL.startsWith("https://message.bilibili.com/");this.fetchSettings().then(t=>{if(t){this.init()}})}get name(){return"messages"}async fetchSettings(){const t=await Ajax.getJsonWithCredentials(`https://api.vc.bilibili.com/link_setting/v1/link_setting/get?msg_notify=1`);if(t.code!==0){return}await this.setNotifyStyle(t.data.msg_notify);return t.data.msg_notify!==3}async init(){const t=await Ajax.getJsonWithCredentials(`https://api.bilibili.com/x/msgfeed/unread`);const e=await Ajax.getJsonWithCredentials(`https://api.vc.bilibili.com/session_svr/v1/session_svr/single_unread`);const a=await SpinQuery.select("#message-list");const i=[...a.querySelectorAll("a[data-name]")];const s=i.map(t=>t.getAttribute("data-name"));if(t.code!==0||e.code!==0){return}t.data["user_msg"]=e.data.unfollow_unread+e.data.follow_unread;let n=s.reduce((e,a)=>e+t.data[a],0);if(!n){return}await this.setNotifyCount(n);s.forEach((e,a)=>{const s=t.data[e];if(s>0){i[a].setAttribute("data-count",s.toString())}else{i[a].removeAttribute("data-count")}});i.forEach(t=>{t.addEventListener("click",()=>{const e=parseInt(t.getAttribute("data-count"));t.removeAttribute("data-count");n-=e;this.setNotifyCount(n)})})}}return{export:{Messages:i}}}})(); -onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-search-box.min.js"] = (()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); +onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-search-box.min.js"] = (()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}if(/^bv[\da-zA-Z]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.replace(/^bv/i,"BV")}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-settings.min.js"] = (()=>{return(e,t)=>{const s=async()=>{await SpinQuery.select(".custom-navbar-settings");const{Slip:s}=await t.importAsync("slip");const r=dq("#custom-navbar-settings");r.addEventListener("click",async()=>{const e=dq(".custom-navbar-settings");if(e){e.classList.toggle("show");dq(".gui-settings-mask").click()}});r.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
  • \n\n {{item.displayName}}\n\n
  • \n`,methods:{hidden(){return e.customNavbarHidden.includes(this.item.name)},viewBorder(e){const t=dq(`.custom-navbar li[data-name='${this.item.name}']`);if(t!==null){t.classList.toggle("view-border",e)}},toggleHidden(){const t=this.hidden();if(t===false){e.customNavbarHidden.push(this.item.name)}else{const t=e.customNavbarHidden.indexOf(this.item.name);if(t===-1){return}e.customNavbarHidden.splice(t,1)}this.$forceUpdate();const s=dq(`.custom-navbar li[data-name='${this.item.name}']`);if(s!==null){s.style.display=t?"flex":"none"}e.customNavbarHidden=e.customNavbarHidden}}});const r=_.debounce(t=>{document.body.style.setProperty("--navbar-bounds-padding",`0 ${t}%`);e.customNavbarBoundsPadding=t},200);new Vue({el:".custom-navbar-settings",mounted(){const t=dq(".custom-navbar-settings .order-list");const r=({sourceItem:s,targetItem:r,orderBefore:a,orderAfter:n})=>{if(a===n){return}const i=Object.entries(e.customNavbarOrder).filter(([e])=>e in customNavbarDefaultOrders);const o=i.sort((e,t)=>e[1]-t[1]).map(e=>e[0]);if(a=n;t--){const s=o[t];e.customNavbarOrder[s]=t+1;const r=dq(`.custom-navbar li[data-name='${s}']`);r.style.order=(t+1).toString()}}e.customNavbarOrder[o[a]]=n;const d=dq(`.custom-navbar li[data-name='${o[a]}']`);d.style.order=n.toString();t.insertBefore(s,r);e.customNavbarOrder=e.customNavbarOrder};new s(t);t.addEventListener("slip:beforewait",e=>{if(e.target.classList.contains("mdi-menu")){e.preventDefault()}},false);t.addEventListener("slip:beforeswipe",e=>e.preventDefault(),false);t.addEventListener("slip:reorder",e=>{r({sourceItem:e.target,targetItem:e.detail.insertBefore,orderBefore:e.detail.originalIndex,orderAfter:e.detail.spliceIndex});return false},false)},computed:{orderList(){const s=Object.entries(e.customNavbarOrder);return s.filter(e=>e[0]in t).sort((e,t)=>e[1]-t[1]).map(e=>{return{displayName:t[e[0]],name:e[0],order:e[1]}})}},data:{boundsPadding:e.customNavbarBoundsPadding},watch:{boundsPadding(e){r(e)}},methods:{close(){dq(".custom-navbar-settings").classList.remove("show")},restoreDefault(){if(typeof customNavbarDefaultOrders==="undefined"){Toast.error("未找到默认值设定, 请更新您的脚本.","自定义顶栏",3e3);return}if(confirm("确定要恢复默认顶栏布局吗? 恢复后页面将刷新.")){this.boundsPadding=5;e.customNavbarOrder=customNavbarDefaultOrders;location.reload()}}}})},{once:true})};return{export:{initSettingsPanel:s}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-simple-link.min.js"] = (()=>{return(t,e)=>{const{NavbarComponent:n}=e.import("custom-navbar-component");class s extends n{constructor(t,e,n){super();this.linkName=n;this.html=t;this.href=e;this.touch=false;this.active=document.URL.startsWith(e)}get name(){return this.linkName+"Link"}}return{export:{SimpleLink:s}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-navbar-subscriptions.min.js"] = (()=>{return(i,s)=>{const{NavbarComponent:a}=s.import("custom-navbar-component");class t extends a{constructor(){super();this.boundingWidth=380;this.noPadding=true;const i=getUID();this.href=`https://space.bilibili.com/${i}/bangumi`;this.html="订阅";this.active=[`https://space.bilibili.com/${i}/bangumi`,`https://space.bilibili.com/${i}/cinema`,`https://space.bilibili.com/${i}/subs`].includes(document.URL.replace(/\?.*$/,""));this.popupHtml=`\n
    \n\n
    \n\n\n\n\n
    \n
    `;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":()=>s.importAsync("dpi-img.vue")},template:`\n
    \n
    \n\n 加载中...\n
    \n
    空空如也哦 = ̄ω ̄=
    \n\n\n\n\n
    \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=${getUID()}`);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"}}return{export:{Subscriptions:t}}}})(); diff --git a/min/bundle.json b/min/bundle.json index ef170d88f..d78c52b79 100644 --- a/min/bundle.json +++ b/min/bundle.json @@ -42,7 +42,7 @@ "custom-navbar-iframe.min.js": "DBE5844C2AA36057DBD33BBC5724D7D7F881AB15EC45A80228961942CD810A32", "custom-navbar-logo.min.js": "236CCC887A3917A6D4840889B7380B648197765B8CDA27CB233F3F1E3215F7BB", "custom-navbar-messages.min.js": "D7B315A4D8FD9E2EF9C1E40C1F3CA7EC18C5A87AC7A9410049061A0D851868DE", - "custom-navbar-search-box.min.js": "9A841B5208555DA542CA40879C395E5438D7E6ECEC5194E69DCF02AC9C4D8801", + "custom-navbar-search-box.min.js": "3543FE8F7F87E8C8C96CB799A7CBCDA4BE5DB863BD97BC1CF37C2657DCF3AE72", "custom-navbar-settings.min.js": "474924B0C90EE6B3DF924D73DFD02DFC2BCF5BAD1F6A4E539A6263D3A751506C", "custom-navbar-simple-link.min.js": "0960197FB525733551435B07D7B024272C21BDD2D8B4F47027046FCE7B3468C5", "custom-navbar-subscriptions.min.js": "8664608EA96BA5E3CC0202F3ED095823B8D2A3DFCDC6D87C192FEA652D0DD554", diff --git a/min/bundle.zip b/min/bundle.zip index 059abb2d9fced778ecec5ac5abe1787440591204..c050d30db54af201cde691c98c5f3801192ba402 100644 GIT binary patch delta 2339 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 diff --git a/min/custom-navbar-search-box.min.js b/min/custom-navbar-search-box.min.js index 0a3adfef0..467244137 100644 --- a/min/custom-navbar-search-box.min.js +++ b/min/custom-navbar-search-box.min.js @@ -1 +1 @@ -(()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); \ No newline at end of file +(()=>{return(e,t)=>{const{NavbarComponent:s}=t.import("custom-navbar-component");const i=new class{getAll(){const e=localStorage.getItem("search_history");if(!e){return[]}return JSON.parse(e).map(e=>{return{keyword:e.value,date:new Date(e.timestamp).toJSON(),count:1}})}saveAll(e){localStorage.setItem("search_history",JSON.stringify(e))}clear(){localStorage.setItem("search_history","[]")}merge(e){const t=this.getAll();return _.uniqBy(e.concat(t),e=>e.keyword).slice(0,10)}add(e){const t=this.getAll();const s=t.find(t=>t.keyword===e.keyword);if(s){Object.assign(s,e)}else{t.push(e)}this.saveAll(t)}remove(e){const t=this.getAll();const s=t.findIndex(t=>t.keyword===e.keyword);if(s>-1){t.splice(s,1);this.saveAll(t)}}};class n extends s{constructor(){super();this.disabled=true;this.html=`\n\n\n\n\n\n\n\n\n 清除搜索历史\n\n\n`;this.init()}async init(){const t=await SpinQuery.select("#custom-navbar-search");const s=t.querySelector("input[name='keyword']");t.addEventListener("submit",i=>{if(s.value===""){if(!e.hideTopSearch){t.querySelector(".recommended-target").click()}i.preventDefault();return false}if(/^av[\d]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.toLowerCase()}`,"_blank");i.preventDefault();return false}if(/^bv[\da-zA-Z]+$/i.test(s.value)){window.open(`https://www.bilibili.com/${s.value.replace(/^bv/i,"BV")}`,"_blank");i.preventDefault();return false}const n=e.searchHistory.find(e=>e.keyword===s.value);if(n){n.count++;n.date=(new Date).toJSON()}else{const t={count:1,keyword:s.value,date:(new Date).toJSON()};e.searchHistory.unshift(t)}e.searchHistory=e.searchHistory.slice(0,10);return true});if(!e.hideTopSearch){const e=await Ajax.getJson("https://api.bilibili.com/x/web-interface/search/default");if(e.code===0){s.setAttribute("placeholder",e.data.show_name);let i;if(e.data.url!==""){i=e.data.url}else if(e.data.name.startsWith("av")){i=`https://www.bilibili.com/${e.data.name}`}else{i=`https://search.bilibili.com/all?keyword=${e.data.name}`}t.querySelector(".recommended-target").setAttribute("href",i)}else{console.error("[自定义顶栏] 获取搜索推荐词失败")}}const i=new Vue({el:dq(".popup.search-list"),data:{items:[],isHistory:true},methods:{submit(e){s.value=e;t.submit();raiseEvent(t,"submit")},nextItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e+2})`);if(t){t.focus()}},previousItem(e){const t=dq(`.custom-navbar .search-list-item:nth-child(${e})`);if(t){t.focus()}else{s.focus();return}},deleteItem(t,s){const i=e.searchHistory.findIndex(e=>e.keyword===t.value);const[n]=e.searchHistory.splice(i,1);e.searchHistory=e.searchHistory;this.items.splice(s,1)},clearSearchHistory(){e.searchHistory=[];this.items=[]}}});let n="";const a=async()=>{const t=s.value;i.isHistory=t==="";if(i.isHistory){i.items=e.searchHistory.sort((e,t)=>{const s=e.date?new Date(e.date):new Date(0);const i=t.date?new Date(t.date):new Date(0);return Number(i)-Number(s)}).map(e=>{return{value:e.keyword,html:e.keyword}}).slice(0,10)}else{const e=`https://s.search.bilibili.com/main/suggest?func=suggest&suggest_type=accurate&sub_type=tag&main_ver=v1&highlight=&userid=${getUID()}&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}`;n=e;const s=await Ajax.getJson(e);if(s.code!==0||n!==e){return}const a=s.result.tag;if(a===undefined){i.items=[];return}i.items=a.map(e=>{return{value:e.value,html:e.name.replace(/suggest_high_light/g,"suggest-highlight")}})}};a();const r=_.debounce(a,200);let o=false;s.addEventListener("compositionstart",()=>o=true);s.addEventListener("compositionend",()=>{o=false;raiseEvent(s,"input")});s.addEventListener("input",()=>{if(!o){r()}});s.addEventListener("keydown",e=>{if(e.key==="ArrowDown"&&i.items.length>0){e.preventDefault();dq(".custom-navbar .search-list-item:first-child").focus()}})}get name(){return"search"}}return{export:{SearchBox:n}}}})(); \ No newline at end of file diff --git a/src/style/custom-navbar/simple/custom-navbar-search-box.ts b/src/style/custom-navbar/simple/custom-navbar-search-box.ts index e138f5429..8c75136aa 100644 --- a/src/style/custom-navbar/simple/custom-navbar-search-box.ts +++ b/src/style/custom-navbar/simple/custom-navbar-search-box.ts @@ -115,6 +115,11 @@ export class SearchBox extends NavbarComponent { e.preventDefault() return false } + if (/^bv[\da-zA-Z]+$/i.test(keywordInput.value)) { + window.open(`https://www.bilibili.com/${keywordInput.value.replace(/^bv/i, 'BV')}`, '_blank') + e.preventDefault() + return false + } // const now = Number(new Date()) // if (keywordInput.value === '拜年祭' && Number(new Date('2020-01-17')) < now && now < Number(new Date('2020-02-01'))) { // window.open(`https://www.bilibili.com/blackboard/xianxing2020bnj.html`)