From e1e6da1e03023fedf7759f73c0da9c68aa689b55 Mon Sep 17 00:00:00 2001 From: the1812 Date: Wed, 5 Feb 2020 10:57:26 +0800 Subject: [PATCH] Hide translate button when no text --- bilibili-evolved.offline.user.js | 2 +- bilibili-evolved.preview-offline.user.js | 2 +- bilibili-evolved.preview.user.js | 2 +- bilibili-evolved.user.js | 2 +- min/bundle.json | 2 +- min/bundle.zip | Bin 1650838 -> 1650861 bytes min/feeds-translate.min.js | 2 +- .../feeds-translate/feeds-translate.ts | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js index 89bc9f63a..36d1a2f75 100644 --- a/bilibili-evolved.offline.user.js +++ b/bilibili-evolved.offline.user.js @@ -1207,7 +1207,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-filter.min.js"] = (()=>{return(e,t)=>{(async()=>{if(document.URL.replace(location.search,"")!=="https://t.bilibili.com/"){return}const e=await SpinQuery.select(".home-container .left-panel");if(e===null){return}e.insertAdjacentHTML("beforeend",html``);new Vue({el:"feeds-filter-card",components:{FeedsFilterCard:()=>t.importAsync("feeds-filter-card.vue")}})})();return{reload:()=>document.body.classList.remove("disable-feeds-filter"),unload:()=>document.body.classList.add("disable-feeds-filter")}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-filter-card.vue.min.js"] = (()=>{return(e,t)=>{const i=`

动态过滤

类型

关键词

{{p}}

侧边栏

`;t.applyStyleFromText(`body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-audio .feed-card .card[data-type="256"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-bangumi .feed-card .card[data-type="512"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-column .feed-card .card[data-type="64"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-miniVideo .feed-card .card[data-type="16"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-repost .feed-card .card[data-type="1"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-share .feed-card .card[data-type="2048"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-text .feed-card .card[data-type="4"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-textWithImages .feed-card .card[data-type="2"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-video .feed-card .card[data-type="8"]{display:none!important}body.enable-feeds-filter:not(.disable-feeds-filter) .left-panel>*,body.enable-feeds-filter:not(.disable-feeds-filter) .right-panel>*{margin:0 0 8px!important}body.enable-feeds-filter:not(.disable-feeds-filter) .feed-card .card.pattern-block,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-following-tags .left-panel .tag-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-live .right-panel .live-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-notice .right-panel .notice-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-profile .left-panel .user-wrapper,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-trending-tags .right-panel .tag-panel{display:none!important}.feeds-filter{background-color:#fff;width:100%;padding:12px 16px;float:left;border-radius:4px;box-sizing:border-box;display:none;flex-direction:column}body.enable-feeds-filter:not(.disable-feeds-filter) .feeds-filter{display:flex}.feeds-filter,.feeds-filter *{transition:.2s ease-out}body.dark .feeds-filter{color:#eee;background-color:#444}.feeds-filter h1{font-weight:400;font-size:14px;margin:0 0 14px}.feeds-filter h2{font-weight:700;font-size:13px;margin:0 0 8px}.feeds-filter .feeds-filter-swtich:not(:last-child){margin-bottom:4px}.feeds-filter .feeds-filter-swtich label{cursor:pointer;margin:0;padding:4px 8px;border-radius:4px;background-color:#0001;display:flex;align-items:center;justify-content:space-between;border:1px solid transparent}.feeds-filter .feeds-filter-swtich label .name{font-size:12px}.feeds-filter .feeds-filter-swtich label .disabled{color:var(--theme-color)!important}.feeds-filter .feeds-filter-swtich label:hover{background-color:#0002}.feeds-filter .feeds-filter-swtich label input{display:none}.feeds-filter .feeds-filter-swtich label .be-icon{font-size:16px}.feeds-filter .feeds-filter-swtich label .be-icon.disabled,.feeds-filter .feeds-filter-swtich label.disabled .be-icon{display:none}.feeds-filter .feeds-filter-swtich label.disabled .be-icon.disabled{display:block}.feeds-filter .filter-type-switch{flex:0 0 49%}.feeds-filter .filter-side-card-switch{flex:0 0 100%}.feeds-filter .filter-types{display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:18px}.feeds-filter .filter-patterns:not(:empty){margin-bottom:8px}.feeds-filter .filter-patterns .pattern{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border-radius:4px;background-color:#0001;font-size:12px}.feeds-filter .filter-patterns .pattern:not(:last-child){margin-bottom:4px}.feeds-filter .filter-patterns .pattern .be-icon{font-size:18px;cursor:pointer}.feeds-filter .add-pattern{display:flex;align-items:center;margin-bottom:18px}.feeds-filter .add-pattern input{color:inherit;background-color:transparent;font-size:12px;border:1px solid #8884;border-radius:4px;outline:0!important;padding:4px;flex:1 0 0;width:0}.feeds-filter .add-pattern input:focus{border-color:var(--theme-color)}.feeds-filter .add-pattern .be-icon{font-size:18px;cursor:pointer;margin-left:8px}`,"feeds-filter-card-style");const s={0:{className:"profile",displayName:"个人资料"},1:{className:"following-tags",displayName:"关注的话题"},2:{className:"notice",displayName:"公告栏"},3:{className:"live",displayName:"正在直播"},4:{className:"trending-tags",displayName:"热门话题"}};const d="feeds-filter-side-block-";return{export:Object.assign({template:i},{components:{FilterTypeSwitch:()=>t.importAsync("filter-type-switch.vue"),Icon:()=>t.importAsync("icon.vue")},methods:{updateCard(t){const i=(e,t)=>{if(e.startsWith("/")&&e.endsWith("/")){return new RegExp(e.slice(1,e.length-1)).test(t)}return t.includes(e)};const s=(()=>{return e.feedsFilterPatterns.some(e=>{const s=e.match(/(.+) up:([^ ]+)/);if(s){return i(s[1],t.text)&&i(s[2],t.username)}return i(e,t.text)})})();if(s){t.element.classList.add("pattern-block")}else{t.element.classList.remove("pattern-block")}},deletePattern(t){const i=e.feedsFilterPatterns.indexOf(t);if(i!==-1){this.patterns.splice(i,1)}},addPattern(e){if(e&&!this.patterns.includes(e)){this.patterns.push(e)}this.newPattern=""},updateBlockSide(){Object.entries(s).forEach(([e,t])=>{const i=d+t.className;document.body.classList[this.blockSideCards.includes(e)?"add":"remove"](i)})},toggleBlockSide(t){const i=this.blockSideCards.indexOf(t);const a=s[t];if(i!==-1){this.blockSideCards.splice(i,1);document.body.classList.remove(d+a.className)}else{this.blockSideCards.push(t);document.body.classList.add(d+a.className)}e.feedsFilterSideCards=this.blockSideCards},sideDisabled(e){return this.blockSideCards.includes(e)}},watch:{patterns(){e.feedsFilterPatterns=this.patterns;if(this.feedsCardsManager!==null){this.feedsCardsManager.cards.forEach(e=>this.updateCard(e))}}},data(){return{allTypes:[],patterns:[...e.feedsFilterPatterns],newPattern:"",feedsCardsManager:null,allSideCards:s,blockSideCards:[...e.feedsFilterSideCards]}},async mounted(){this.updateBlockSide();const e=await SpinQuery.select(".feed-card .tab-bar");if(!e){console.error("tabBar not found");return}const i=e.querySelector(".tab:nth-child(1) .tab-text");Observer.attributes(i,()=>{document.body.classList.toggle("enable-feeds-filter",i.classList.contains("selected"))});const{feedsCardsManager:s,feedsCardTypes:d}=await t.importAsync("feeds-apis");const a=await s.startWatching();if(!a){console.error("feedsCardsManager.startWatching() failed");return}this.allTypes=Object.entries(d);s.cards.forEach(e=>this.updateCard(e));s.addEventListener("addCard",e=>{const t=e.detail;this.updateCard(t)});this.feedsCardsManager=s}})}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate.min.css"] = `.card-content .translate-container{margin-top:10px}.card-content .translate-container .translated{font-size:12px;color:#aaa}.card-content .translate-container .translated a{color:var(--theme-color)}.card-content .translate-container .translate{font-size:12px;color:var(--theme-color);cursor:pointer}.card-content .translate-container .translating{font-size:18px}.card-content .translate-container .translate-result{padding-top:10px;white-space:pre-wrap;line-height:22px}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate.min.js"] = (()=>{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate.min.js"] = (()=>{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text.replace(/#(.+?)#/g,"")===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate-providers.min.js"] = (()=>{return(t,e)=>{class n{}class s extends n{constructor(){super(...arguments);this.name="Bing";this.link="https://translate.bing.com/"}async translate(t,e){const n="zh-Hans";let s=_.get(e,"targetLanguage",n);if(s.includes("-")&&s!==n){s=s.substring(0,s.indexOf("-"))}const a=await Ajax.monkey({url:"https://cn.bing.com/ttranslatev3",method:"POST",data:Object.entries({fromLang:"auto-detect",to:s,text:t}).map(([t,e])=>`${t}=${e}`).join("&"),headers:{"User-Agent":UserAgent,"Content-Type":"application/x-www-form-urlencoded"},responseType:"json"});const[r]=a;if(r.translations){return r.translations.map(t=>t.text).join("\n")}else{throw new Error("调用Bing翻译失败.\n"+JSON.stringify(r))}}}class a extends n{constructor(){super(...arguments);this.name="Google";this.link="https://translate.google.com/";this.apiUrl="https://translate.google.com/translate_a/single"}async translate(t,e){const n="zh";let s=_.get(e,"targetLanguage",n);if(s.includes("-")&&s!==n){s=s.substring(0,s.indexOf("-"))}const a=await Ajax.monkey({url:`${this.apiUrl}?${Object.entries({client:"gtx",sl:"auto",tl:s,dt:"t",q:encodeURIComponent(t)}).map(([t,e])=>`${t}=${e}`).join("&")}`,method:"GET",headers:{"User-Agent":UserAgent},responseType:"json"});console.log(_.flattenDeep(a),a,a[0].map(t=>t[0]).join("\n"));const r=a[0].map(t=>t[0]).join("");return r}}class r extends a{constructor(){super(...arguments);this.link="https://translate.google.cn/";this.apiUrl="https://translate.google.cn/translate_a/single"}}const o=()=>{switch(t.feedsTranslateProvider){default:case"Bing":return new s;case"Google":return new a;case"GoogleCN":return new r}};return{export:{getTranslator:o}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/ffmpeg-support.min.js"] = (()=>{return(e,t)=>{const n=[".mp4",".m4a"];const r=(e,t,n)=>{if(e<2){return null}const r=[];for(let s=1;s<=e;s++){let e=` - ${s}`;if(n.includes(".m4a")){e=""}const l=escapeFilename(`${t}${e}${n[s-1]}`).replace(/'/g,"'\\''");r.push(`file '${l}'`)}return r.join("\n")};const s=(e,t)=>{const r=e=>e.fragments.length>1;const s=e.filter(r);if(s.length===0){return null}const l=new Map;s.forEach(e=>{l.set(escapeFilename(`ffmpeg-files-${e.title}.txt`),e.fragments.map((r,s)=>{let l=` - ${s+1}`;if(t===true){l=""}const a=escapeFilename(`${e.title}${l}${t===true?n[s]:t}`).replace(/'/g,"'\\''");return`file '${a}'`}).join("\n"))});return l};const l=(e,t)=>{const r=[];e.forEach(e=>{e.fragments.forEach((s,l)=>{let a="";if(e.fragments.length>1&&t!==true){a=` - ${l+1}`}const c=escapeFilename(`${e.title}${a}${t===true?n[l]:t}`).replace(/'/g,"'\\''");r.push(`file '${c}'`)})});return r.join("\n")};return{export:{getFragmentsList:r,getBatchFragmentsList:s,getBatchEpisodesList:l}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/fill-with-comments.min.js"] = (()=>{return(t,e)=>{const n="fill-with-comments-style";const l=t=>{};return{export:{fillWithComments:l}}}})(); diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js index a789a91a9..181ec24ed 100644 --- a/bilibili-evolved.preview-offline.user.js +++ b/bilibili-evolved.preview-offline.user.js @@ -1207,7 +1207,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-filter.min.js"] = (()=>{return(e,t)=>{(async()=>{if(document.URL.replace(location.search,"")!=="https://t.bilibili.com/"){return}const e=await SpinQuery.select(".home-container .left-panel");if(e===null){return}e.insertAdjacentHTML("beforeend",html``);new Vue({el:"feeds-filter-card",components:{FeedsFilterCard:()=>t.importAsync("feeds-filter-card.vue")}})})();return{reload:()=>document.body.classList.remove("disable-feeds-filter"),unload:()=>document.body.classList.add("disable-feeds-filter")}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-filter-card.vue.min.js"] = (()=>{return(e,t)=>{const i=`

动态过滤

类型

关键词

{{p}}

侧边栏

`;t.applyStyleFromText(`body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-audio .feed-card .card[data-type="256"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-bangumi .feed-card .card[data-type="512"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-column .feed-card .card[data-type="64"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-miniVideo .feed-card .card[data-type="16"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-repost .feed-card .card[data-type="1"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-share .feed-card .card[data-type="2048"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-text .feed-card .card[data-type="4"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-textWithImages .feed-card .card[data-type="2"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-video .feed-card .card[data-type="8"]{display:none!important}body.enable-feeds-filter:not(.disable-feeds-filter) .left-panel>*,body.enable-feeds-filter:not(.disable-feeds-filter) .right-panel>*{margin:0 0 8px!important}body.enable-feeds-filter:not(.disable-feeds-filter) .feed-card .card.pattern-block,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-following-tags .left-panel .tag-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-live .right-panel .live-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-notice .right-panel .notice-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-profile .left-panel .user-wrapper,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-trending-tags .right-panel .tag-panel{display:none!important}.feeds-filter{background-color:#fff;width:100%;padding:12px 16px;float:left;border-radius:4px;box-sizing:border-box;display:none;flex-direction:column}body.enable-feeds-filter:not(.disable-feeds-filter) .feeds-filter{display:flex}.feeds-filter,.feeds-filter *{transition:.2s ease-out}body.dark .feeds-filter{color:#eee;background-color:#444}.feeds-filter h1{font-weight:400;font-size:14px;margin:0 0 14px}.feeds-filter h2{font-weight:700;font-size:13px;margin:0 0 8px}.feeds-filter .feeds-filter-swtich:not(:last-child){margin-bottom:4px}.feeds-filter .feeds-filter-swtich label{cursor:pointer;margin:0;padding:4px 8px;border-radius:4px;background-color:#0001;display:flex;align-items:center;justify-content:space-between;border:1px solid transparent}.feeds-filter .feeds-filter-swtich label .name{font-size:12px}.feeds-filter .feeds-filter-swtich label .disabled{color:var(--theme-color)!important}.feeds-filter .feeds-filter-swtich label:hover{background-color:#0002}.feeds-filter .feeds-filter-swtich label input{display:none}.feeds-filter .feeds-filter-swtich label .be-icon{font-size:16px}.feeds-filter .feeds-filter-swtich label .be-icon.disabled,.feeds-filter .feeds-filter-swtich label.disabled .be-icon{display:none}.feeds-filter .feeds-filter-swtich label.disabled .be-icon.disabled{display:block}.feeds-filter .filter-type-switch{flex:0 0 49%}.feeds-filter .filter-side-card-switch{flex:0 0 100%}.feeds-filter .filter-types{display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:18px}.feeds-filter .filter-patterns:not(:empty){margin-bottom:8px}.feeds-filter .filter-patterns .pattern{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border-radius:4px;background-color:#0001;font-size:12px}.feeds-filter .filter-patterns .pattern:not(:last-child){margin-bottom:4px}.feeds-filter .filter-patterns .pattern .be-icon{font-size:18px;cursor:pointer}.feeds-filter .add-pattern{display:flex;align-items:center;margin-bottom:18px}.feeds-filter .add-pattern input{color:inherit;background-color:transparent;font-size:12px;border:1px solid #8884;border-radius:4px;outline:0!important;padding:4px;flex:1 0 0;width:0}.feeds-filter .add-pattern input:focus{border-color:var(--theme-color)}.feeds-filter .add-pattern .be-icon{font-size:18px;cursor:pointer;margin-left:8px}`,"feeds-filter-card-style");const s={0:{className:"profile",displayName:"个人资料"},1:{className:"following-tags",displayName:"关注的话题"},2:{className:"notice",displayName:"公告栏"},3:{className:"live",displayName:"正在直播"},4:{className:"trending-tags",displayName:"热门话题"}};const d="feeds-filter-side-block-";return{export:Object.assign({template:i},{components:{FilterTypeSwitch:()=>t.importAsync("filter-type-switch.vue"),Icon:()=>t.importAsync("icon.vue")},methods:{updateCard(t){const i=(e,t)=>{if(e.startsWith("/")&&e.endsWith("/")){return new RegExp(e.slice(1,e.length-1)).test(t)}return t.includes(e)};const s=(()=>{return e.feedsFilterPatterns.some(e=>{const s=e.match(/(.+) up:([^ ]+)/);if(s){return i(s[1],t.text)&&i(s[2],t.username)}return i(e,t.text)})})();if(s){t.element.classList.add("pattern-block")}else{t.element.classList.remove("pattern-block")}},deletePattern(t){const i=e.feedsFilterPatterns.indexOf(t);if(i!==-1){this.patterns.splice(i,1)}},addPattern(e){if(e&&!this.patterns.includes(e)){this.patterns.push(e)}this.newPattern=""},updateBlockSide(){Object.entries(s).forEach(([e,t])=>{const i=d+t.className;document.body.classList[this.blockSideCards.includes(e)?"add":"remove"](i)})},toggleBlockSide(t){const i=this.blockSideCards.indexOf(t);const a=s[t];if(i!==-1){this.blockSideCards.splice(i,1);document.body.classList.remove(d+a.className)}else{this.blockSideCards.push(t);document.body.classList.add(d+a.className)}e.feedsFilterSideCards=this.blockSideCards},sideDisabled(e){return this.blockSideCards.includes(e)}},watch:{patterns(){e.feedsFilterPatterns=this.patterns;if(this.feedsCardsManager!==null){this.feedsCardsManager.cards.forEach(e=>this.updateCard(e))}}},data(){return{allTypes:[],patterns:[...e.feedsFilterPatterns],newPattern:"",feedsCardsManager:null,allSideCards:s,blockSideCards:[...e.feedsFilterSideCards]}},async mounted(){this.updateBlockSide();const e=await SpinQuery.select(".feed-card .tab-bar");if(!e){console.error("tabBar not found");return}const i=e.querySelector(".tab:nth-child(1) .tab-text");Observer.attributes(i,()=>{document.body.classList.toggle("enable-feeds-filter",i.classList.contains("selected"))});const{feedsCardsManager:s,feedsCardTypes:d}=await t.importAsync("feeds-apis");const a=await s.startWatching();if(!a){console.error("feedsCardsManager.startWatching() failed");return}this.allTypes=Object.entries(d);s.cards.forEach(e=>this.updateCard(e));s.addEventListener("addCard",e=>{const t=e.detail;this.updateCard(t)});this.feedsCardsManager=s}})}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate.min.css"] = `.card-content .translate-container{margin-top:10px}.card-content .translate-container .translated{font-size:12px;color:#aaa}.card-content .translate-container .translated a{color:var(--theme-color)}.card-content .translate-container .translate{font-size:12px;color:var(--theme-color);cursor:pointer}.card-content .translate-container .translating{font-size:18px}.card-content .translate-container .translate-result{padding-top:10px;white-space:pre-wrap;line-height:22px}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate.min.js"] = (()=>{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate.min.js"] = (()=>{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text.replace(/#(.+?)#/g,"")===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate-providers.min.js"] = (()=>{return(t,e)=>{class n{}class s extends n{constructor(){super(...arguments);this.name="Bing";this.link="https://translate.bing.com/"}async translate(t,e){const n="zh-Hans";let s=_.get(e,"targetLanguage",n);if(s.includes("-")&&s!==n){s=s.substring(0,s.indexOf("-"))}const a=await Ajax.monkey({url:"https://cn.bing.com/ttranslatev3",method:"POST",data:Object.entries({fromLang:"auto-detect",to:s,text:t}).map(([t,e])=>`${t}=${e}`).join("&"),headers:{"User-Agent":UserAgent,"Content-Type":"application/x-www-form-urlencoded"},responseType:"json"});const[r]=a;if(r.translations){return r.translations.map(t=>t.text).join("\n")}else{throw new Error("调用Bing翻译失败.\n"+JSON.stringify(r))}}}class a extends n{constructor(){super(...arguments);this.name="Google";this.link="https://translate.google.com/";this.apiUrl="https://translate.google.com/translate_a/single"}async translate(t,e){const n="zh";let s=_.get(e,"targetLanguage",n);if(s.includes("-")&&s!==n){s=s.substring(0,s.indexOf("-"))}const a=await Ajax.monkey({url:`${this.apiUrl}?${Object.entries({client:"gtx",sl:"auto",tl:s,dt:"t",q:encodeURIComponent(t)}).map(([t,e])=>`${t}=${e}`).join("&")}`,method:"GET",headers:{"User-Agent":UserAgent},responseType:"json"});console.log(_.flattenDeep(a),a,a[0].map(t=>t[0]).join("\n"));const r=a[0].map(t=>t[0]).join("");return r}}class r extends a{constructor(){super(...arguments);this.link="https://translate.google.cn/";this.apiUrl="https://translate.google.cn/translate_a/single"}}const o=()=>{switch(t.feedsTranslateProvider){default:case"Bing":return new s;case"Google":return new a;case"GoogleCN":return new r}};return{export:{getTranslator:o}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/ffmpeg-support.min.js"] = (()=>{return(e,t)=>{const n=[".mp4",".m4a"];const r=(e,t,n)=>{if(e<2){return null}const r=[];for(let s=1;s<=e;s++){let e=` - ${s}`;if(n.includes(".m4a")){e=""}const l=escapeFilename(`${t}${e}${n[s-1]}`).replace(/'/g,"'\\''");r.push(`file '${l}'`)}return r.join("\n")};const s=(e,t)=>{const r=e=>e.fragments.length>1;const s=e.filter(r);if(s.length===0){return null}const l=new Map;s.forEach(e=>{l.set(escapeFilename(`ffmpeg-files-${e.title}.txt`),e.fragments.map((r,s)=>{let l=` - ${s+1}`;if(t===true){l=""}const a=escapeFilename(`${e.title}${l}${t===true?n[s]:t}`).replace(/'/g,"'\\''");return`file '${a}'`}).join("\n"))});return l};const l=(e,t)=>{const r=[];e.forEach(e=>{e.fragments.forEach((s,l)=>{let a="";if(e.fragments.length>1&&t!==true){a=` - ${l+1}`}const c=escapeFilename(`${e.title}${a}${t===true?n[l]:t}`).replace(/'/g,"'\\''");r.push(`file '${c}'`)})});return r.join("\n")};return{export:{getFragmentsList:r,getBatchFragmentsList:s,getBatchEpisodesList:l}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/fill-with-comments.min.js"] = (()=>{return(t,e)=>{const n="fill-with-comments-style";const l=t=>{};return{export:{fillWithComments:l}}}})(); diff --git a/bilibili-evolved.preview.user.js b/bilibili-evolved.preview.user.js index 0ca4fd8c6..e4559b836 100644 --- a/bilibili-evolved.preview.user.js +++ b/bilibili-evolved.preview.user.js @@ -1206,7 +1206,7 @@ onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/m onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/feeds-filter.min.js"] = (()=>{return(e,t)=>{(async()=>{if(document.URL.replace(location.search,"")!=="https://t.bilibili.com/"){return}const e=await SpinQuery.select(".home-container .left-panel");if(e===null){return}e.insertAdjacentHTML("beforeend",html``);new Vue({el:"feeds-filter-card",components:{FeedsFilterCard:()=>t.importAsync("feeds-filter-card.vue")}})})();return{reload:()=>document.body.classList.remove("disable-feeds-filter"),unload:()=>document.body.classList.add("disable-feeds-filter")}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/feeds-filter-card.vue.min.js"] = (()=>{return(e,t)=>{const i=`

动态过滤

类型

关键词

{{p}}

侧边栏

`;t.applyStyleFromText(`body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-audio .feed-card .card[data-type="256"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-bangumi .feed-card .card[data-type="512"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-column .feed-card .card[data-type="64"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-miniVideo .feed-card .card[data-type="16"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-repost .feed-card .card[data-type="1"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-share .feed-card .card[data-type="2048"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-text .feed-card .card[data-type="4"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-textWithImages .feed-card .card[data-type="2"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-video .feed-card .card[data-type="8"]{display:none!important}body.enable-feeds-filter:not(.disable-feeds-filter) .left-panel>*,body.enable-feeds-filter:not(.disable-feeds-filter) .right-panel>*{margin:0 0 8px!important}body.enable-feeds-filter:not(.disable-feeds-filter) .feed-card .card.pattern-block,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-following-tags .left-panel .tag-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-live .right-panel .live-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-notice .right-panel .notice-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-profile .left-panel .user-wrapper,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-trending-tags .right-panel .tag-panel{display:none!important}.feeds-filter{background-color:#fff;width:100%;padding:12px 16px;float:left;border-radius:4px;box-sizing:border-box;display:none;flex-direction:column}body.enable-feeds-filter:not(.disable-feeds-filter) .feeds-filter{display:flex}.feeds-filter,.feeds-filter *{transition:.2s ease-out}body.dark .feeds-filter{color:#eee;background-color:#444}.feeds-filter h1{font-weight:400;font-size:14px;margin:0 0 14px}.feeds-filter h2{font-weight:700;font-size:13px;margin:0 0 8px}.feeds-filter .feeds-filter-swtich:not(:last-child){margin-bottom:4px}.feeds-filter .feeds-filter-swtich label{cursor:pointer;margin:0;padding:4px 8px;border-radius:4px;background-color:#0001;display:flex;align-items:center;justify-content:space-between;border:1px solid transparent}.feeds-filter .feeds-filter-swtich label .name{font-size:12px}.feeds-filter .feeds-filter-swtich label .disabled{color:var(--theme-color)!important}.feeds-filter .feeds-filter-swtich label:hover{background-color:#0002}.feeds-filter .feeds-filter-swtich label input{display:none}.feeds-filter .feeds-filter-swtich label .be-icon{font-size:16px}.feeds-filter .feeds-filter-swtich label .be-icon.disabled,.feeds-filter .feeds-filter-swtich label.disabled .be-icon{display:none}.feeds-filter .feeds-filter-swtich label.disabled .be-icon.disabled{display:block}.feeds-filter .filter-type-switch{flex:0 0 49%}.feeds-filter .filter-side-card-switch{flex:0 0 100%}.feeds-filter .filter-types{display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:18px}.feeds-filter .filter-patterns:not(:empty){margin-bottom:8px}.feeds-filter .filter-patterns .pattern{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border-radius:4px;background-color:#0001;font-size:12px}.feeds-filter .filter-patterns .pattern:not(:last-child){margin-bottom:4px}.feeds-filter .filter-patterns .pattern .be-icon{font-size:18px;cursor:pointer}.feeds-filter .add-pattern{display:flex;align-items:center;margin-bottom:18px}.feeds-filter .add-pattern input{color:inherit;background-color:transparent;font-size:12px;border:1px solid #8884;border-radius:4px;outline:0!important;padding:4px;flex:1 0 0;width:0}.feeds-filter .add-pattern input:focus{border-color:var(--theme-color)}.feeds-filter .add-pattern .be-icon{font-size:18px;cursor:pointer;margin-left:8px}`,"feeds-filter-card-style");const s={0:{className:"profile",displayName:"个人资料"},1:{className:"following-tags",displayName:"关注的话题"},2:{className:"notice",displayName:"公告栏"},3:{className:"live",displayName:"正在直播"},4:{className:"trending-tags",displayName:"热门话题"}};const d="feeds-filter-side-block-";return{export:Object.assign({template:i},{components:{FilterTypeSwitch:()=>t.importAsync("filter-type-switch.vue"),Icon:()=>t.importAsync("icon.vue")},methods:{updateCard(t){const i=(e,t)=>{if(e.startsWith("/")&&e.endsWith("/")){return new RegExp(e.slice(1,e.length-1)).test(t)}return t.includes(e)};const s=(()=>{return e.feedsFilterPatterns.some(e=>{const s=e.match(/(.+) up:([^ ]+)/);if(s){return i(s[1],t.text)&&i(s[2],t.username)}return i(e,t.text)})})();if(s){t.element.classList.add("pattern-block")}else{t.element.classList.remove("pattern-block")}},deletePattern(t){const i=e.feedsFilterPatterns.indexOf(t);if(i!==-1){this.patterns.splice(i,1)}},addPattern(e){if(e&&!this.patterns.includes(e)){this.patterns.push(e)}this.newPattern=""},updateBlockSide(){Object.entries(s).forEach(([e,t])=>{const i=d+t.className;document.body.classList[this.blockSideCards.includes(e)?"add":"remove"](i)})},toggleBlockSide(t){const i=this.blockSideCards.indexOf(t);const a=s[t];if(i!==-1){this.blockSideCards.splice(i,1);document.body.classList.remove(d+a.className)}else{this.blockSideCards.push(t);document.body.classList.add(d+a.className)}e.feedsFilterSideCards=this.blockSideCards},sideDisabled(e){return this.blockSideCards.includes(e)}},watch:{patterns(){e.feedsFilterPatterns=this.patterns;if(this.feedsCardsManager!==null){this.feedsCardsManager.cards.forEach(e=>this.updateCard(e))}}},data(){return{allTypes:[],patterns:[...e.feedsFilterPatterns],newPattern:"",feedsCardsManager:null,allSideCards:s,blockSideCards:[...e.feedsFilterSideCards]}},async mounted(){this.updateBlockSide();const e=await SpinQuery.select(".feed-card .tab-bar");if(!e){console.error("tabBar not found");return}const i=e.querySelector(".tab:nth-child(1) .tab-text");Observer.attributes(i,()=>{document.body.classList.toggle("enable-feeds-filter",i.classList.contains("selected"))});const{feedsCardsManager:s,feedsCardTypes:d}=await t.importAsync("feeds-apis");const a=await s.startWatching();if(!a){console.error("feedsCardsManager.startWatching() failed");return}this.allTypes=Object.entries(d);s.cards.forEach(e=>this.updateCard(e));s.addEventListener("addCard",e=>{const t=e.detail;this.updateCard(t)});this.feedsCardsManager=s}})}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/feeds-translate.min.css"] = `.card-content .translate-container{margin-top:10px}.card-content .translate-container .translated{font-size:12px;color:#aaa}.card-content .translate-container .translated a{color:var(--theme-color)}.card-content .translate-container .translate{font-size:12px;color:var(--theme-color);cursor:pointer}.card-content .translate-container .translating{font-size:18px}.card-content .translate-container .translate-result{padding-top:10px;white-space:pre-wrap;line-height:22px}`; -onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/feeds-translate.min.js"] = (()=>{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); +onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/feeds-translate.min.js"] = (()=>{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text.replace(/#(.+?)#/g,"")===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/feeds-translate-providers.min.js"] = (()=>{return(t,e)=>{class n{}class s extends n{constructor(){super(...arguments);this.name="Bing";this.link="https://translate.bing.com/"}async translate(t,e){const n="zh-Hans";let s=_.get(e,"targetLanguage",n);if(s.includes("-")&&s!==n){s=s.substring(0,s.indexOf("-"))}const a=await Ajax.monkey({url:"https://cn.bing.com/ttranslatev3",method:"POST",data:Object.entries({fromLang:"auto-detect",to:s,text:t}).map(([t,e])=>`${t}=${e}`).join("&"),headers:{"User-Agent":UserAgent,"Content-Type":"application/x-www-form-urlencoded"},responseType:"json"});const[r]=a;if(r.translations){return r.translations.map(t=>t.text).join("\n")}else{throw new Error("调用Bing翻译失败.\n"+JSON.stringify(r))}}}class a extends n{constructor(){super(...arguments);this.name="Google";this.link="https://translate.google.com/";this.apiUrl="https://translate.google.com/translate_a/single"}async translate(t,e){const n="zh";let s=_.get(e,"targetLanguage",n);if(s.includes("-")&&s!==n){s=s.substring(0,s.indexOf("-"))}const a=await Ajax.monkey({url:`${this.apiUrl}?${Object.entries({client:"gtx",sl:"auto",tl:s,dt:"t",q:encodeURIComponent(t)}).map(([t,e])=>`${t}=${e}`).join("&")}`,method:"GET",headers:{"User-Agent":UserAgent},responseType:"json"});console.log(_.flattenDeep(a),a,a[0].map(t=>t[0]).join("\n"));const r=a[0].map(t=>t[0]).join("");return r}}class r extends a{constructor(){super(...arguments);this.link="https://translate.google.cn/";this.apiUrl="https://translate.google.cn/translate_a/single"}}const o=()=>{switch(t.feedsTranslateProvider){default:case"Bing":return new s;case"Google":return new a;case"GoogleCN":return new r}};return{export:{getTranslator:o}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/ffmpeg-support.min.js"] = (()=>{return(e,t)=>{const n=[".mp4",".m4a"];const r=(e,t,n)=>{if(e<2){return null}const r=[];for(let s=1;s<=e;s++){let e=` - ${s}`;if(n.includes(".m4a")){e=""}const l=escapeFilename(`${t}${e}${n[s-1]}`).replace(/'/g,"'\\''");r.push(`file '${l}'`)}return r.join("\n")};const s=(e,t)=>{const r=e=>e.fragments.length>1;const s=e.filter(r);if(s.length===0){return null}const l=new Map;s.forEach(e=>{l.set(escapeFilename(`ffmpeg-files-${e.title}.txt`),e.fragments.map((r,s)=>{let l=` - ${s+1}`;if(t===true){l=""}const a=escapeFilename(`${e.title}${l}${t===true?n[s]:t}`).replace(/'/g,"'\\''");return`file '${a}'`}).join("\n"))});return l};const l=(e,t)=>{const r=[];e.forEach(e=>{e.fragments.forEach((s,l)=>{let a="";if(e.fragments.length>1&&t!==true){a=` - ${l+1}`}const c=escapeFilename(`${e.title}${a}${t===true?n[l]:t}`).replace(/'/g,"'\\''");r.push(`file '${c}'`)})});return r.join("\n")};return{export:{getFragmentsList:r,getBatchFragmentsList:s,getBatchEpisodesList:l}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/fill-with-comments.min.js"] = (()=>{return(t,e)=>{const n="fill-with-comments-style";const l=t=>{};return{export:{fillWithComments:l}}}})(); diff --git a/bilibili-evolved.user.js b/bilibili-evolved.user.js index 960a3df82..30292a600 100644 --- a/bilibili-evolved.user.js +++ b/bilibili-evolved.user.js @@ -1206,7 +1206,7 @@ onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/mi onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-filter.min.js"] = (()=>{return(e,t)=>{(async()=>{if(document.URL.replace(location.search,"")!=="https://t.bilibili.com/"){return}const e=await SpinQuery.select(".home-container .left-panel");if(e===null){return}e.insertAdjacentHTML("beforeend",html``);new Vue({el:"feeds-filter-card",components:{FeedsFilterCard:()=>t.importAsync("feeds-filter-card.vue")}})})();return{reload:()=>document.body.classList.remove("disable-feeds-filter"),unload:()=>document.body.classList.add("disable-feeds-filter")}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-filter-card.vue.min.js"] = (()=>{return(e,t)=>{const i=`

动态过滤

类型

关键词

{{p}}

侧边栏

`;t.applyStyleFromText(`body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-audio .feed-card .card[data-type="256"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-bangumi .feed-card .card[data-type="512"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-column .feed-card .card[data-type="64"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-miniVideo .feed-card .card[data-type="16"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-repost .feed-card .card[data-type="1"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-share .feed-card .card[data-type="2048"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-text .feed-card .card[data-type="4"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-textWithImages .feed-card .card[data-type="2"],body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-block-video .feed-card .card[data-type="8"]{display:none!important}body.enable-feeds-filter:not(.disable-feeds-filter) .left-panel>*,body.enable-feeds-filter:not(.disable-feeds-filter) .right-panel>*{margin:0 0 8px!important}body.enable-feeds-filter:not(.disable-feeds-filter) .feed-card .card.pattern-block,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-following-tags .left-panel .tag-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-live .right-panel .live-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-notice .right-panel .notice-panel,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-profile .left-panel .user-wrapper,body.enable-feeds-filter:not(.disable-feeds-filter).feeds-filter-side-block-trending-tags .right-panel .tag-panel{display:none!important}.feeds-filter{background-color:#fff;width:100%;padding:12px 16px;float:left;border-radius:4px;box-sizing:border-box;display:none;flex-direction:column}body.enable-feeds-filter:not(.disable-feeds-filter) .feeds-filter{display:flex}.feeds-filter,.feeds-filter *{transition:.2s ease-out}body.dark .feeds-filter{color:#eee;background-color:#444}.feeds-filter h1{font-weight:400;font-size:14px;margin:0 0 14px}.feeds-filter h2{font-weight:700;font-size:13px;margin:0 0 8px}.feeds-filter .feeds-filter-swtich:not(:last-child){margin-bottom:4px}.feeds-filter .feeds-filter-swtich label{cursor:pointer;margin:0;padding:4px 8px;border-radius:4px;background-color:#0001;display:flex;align-items:center;justify-content:space-between;border:1px solid transparent}.feeds-filter .feeds-filter-swtich label .name{font-size:12px}.feeds-filter .feeds-filter-swtich label .disabled{color:var(--theme-color)!important}.feeds-filter .feeds-filter-swtich label:hover{background-color:#0002}.feeds-filter .feeds-filter-swtich label input{display:none}.feeds-filter .feeds-filter-swtich label .be-icon{font-size:16px}.feeds-filter .feeds-filter-swtich label .be-icon.disabled,.feeds-filter .feeds-filter-swtich label.disabled .be-icon{display:none}.feeds-filter .feeds-filter-swtich label.disabled .be-icon.disabled{display:block}.feeds-filter .filter-type-switch{flex:0 0 49%}.feeds-filter .filter-side-card-switch{flex:0 0 100%}.feeds-filter .filter-types{display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:18px}.feeds-filter .filter-patterns:not(:empty){margin-bottom:8px}.feeds-filter .filter-patterns .pattern{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border-radius:4px;background-color:#0001;font-size:12px}.feeds-filter .filter-patterns .pattern:not(:last-child){margin-bottom:4px}.feeds-filter .filter-patterns .pattern .be-icon{font-size:18px;cursor:pointer}.feeds-filter .add-pattern{display:flex;align-items:center;margin-bottom:18px}.feeds-filter .add-pattern input{color:inherit;background-color:transparent;font-size:12px;border:1px solid #8884;border-radius:4px;outline:0!important;padding:4px;flex:1 0 0;width:0}.feeds-filter .add-pattern input:focus{border-color:var(--theme-color)}.feeds-filter .add-pattern .be-icon{font-size:18px;cursor:pointer;margin-left:8px}`,"feeds-filter-card-style");const s={0:{className:"profile",displayName:"个人资料"},1:{className:"following-tags",displayName:"关注的话题"},2:{className:"notice",displayName:"公告栏"},3:{className:"live",displayName:"正在直播"},4:{className:"trending-tags",displayName:"热门话题"}};const d="feeds-filter-side-block-";return{export:Object.assign({template:i},{components:{FilterTypeSwitch:()=>t.importAsync("filter-type-switch.vue"),Icon:()=>t.importAsync("icon.vue")},methods:{updateCard(t){const i=(e,t)=>{if(e.startsWith("/")&&e.endsWith("/")){return new RegExp(e.slice(1,e.length-1)).test(t)}return t.includes(e)};const s=(()=>{return e.feedsFilterPatterns.some(e=>{const s=e.match(/(.+) up:([^ ]+)/);if(s){return i(s[1],t.text)&&i(s[2],t.username)}return i(e,t.text)})})();if(s){t.element.classList.add("pattern-block")}else{t.element.classList.remove("pattern-block")}},deletePattern(t){const i=e.feedsFilterPatterns.indexOf(t);if(i!==-1){this.patterns.splice(i,1)}},addPattern(e){if(e&&!this.patterns.includes(e)){this.patterns.push(e)}this.newPattern=""},updateBlockSide(){Object.entries(s).forEach(([e,t])=>{const i=d+t.className;document.body.classList[this.blockSideCards.includes(e)?"add":"remove"](i)})},toggleBlockSide(t){const i=this.blockSideCards.indexOf(t);const a=s[t];if(i!==-1){this.blockSideCards.splice(i,1);document.body.classList.remove(d+a.className)}else{this.blockSideCards.push(t);document.body.classList.add(d+a.className)}e.feedsFilterSideCards=this.blockSideCards},sideDisabled(e){return this.blockSideCards.includes(e)}},watch:{patterns(){e.feedsFilterPatterns=this.patterns;if(this.feedsCardsManager!==null){this.feedsCardsManager.cards.forEach(e=>this.updateCard(e))}}},data(){return{allTypes:[],patterns:[...e.feedsFilterPatterns],newPattern:"",feedsCardsManager:null,allSideCards:s,blockSideCards:[...e.feedsFilterSideCards]}},async mounted(){this.updateBlockSide();const e=await SpinQuery.select(".feed-card .tab-bar");if(!e){console.error("tabBar not found");return}const i=e.querySelector(".tab:nth-child(1) .tab-text");Observer.attributes(i,()=>{document.body.classList.toggle("enable-feeds-filter",i.classList.contains("selected"))});const{feedsCardsManager:s,feedsCardTypes:d}=await t.importAsync("feeds-apis");const a=await s.startWatching();if(!a){console.error("feedsCardsManager.startWatching() failed");return}this.allTypes=Object.entries(d);s.cards.forEach(e=>this.updateCard(e));s.addEventListener("addCard",e=>{const t=e.detail;this.updateCard(t)});this.feedsCardsManager=s}})}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate.min.css"] = `.card-content .translate-container{margin-top:10px}.card-content .translate-container .translated{font-size:12px;color:#aaa}.card-content .translate-container .translated a{color:var(--theme-color)}.card-content .translate-container .translate{font-size:12px;color:var(--theme-color);cursor:pointer}.card-content .translate-container .translating{font-size:18px}.card-content .translate-container .translate-result{padding-top:10px;white-space:pre-wrap;line-height:22px}`; -onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate.min.js"] = (()=>{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); +onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate.min.js"] = (()=>{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text.replace(/#(.+?)#/g,"")===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/feeds-translate-providers.min.js"] = (()=>{return(t,e)=>{class n{}class s extends n{constructor(){super(...arguments);this.name="Bing";this.link="https://translate.bing.com/"}async translate(t,e){const n="zh-Hans";let s=_.get(e,"targetLanguage",n);if(s.includes("-")&&s!==n){s=s.substring(0,s.indexOf("-"))}const a=await Ajax.monkey({url:"https://cn.bing.com/ttranslatev3",method:"POST",data:Object.entries({fromLang:"auto-detect",to:s,text:t}).map(([t,e])=>`${t}=${e}`).join("&"),headers:{"User-Agent":UserAgent,"Content-Type":"application/x-www-form-urlencoded"},responseType:"json"});const[r]=a;if(r.translations){return r.translations.map(t=>t.text).join("\n")}else{throw new Error("调用Bing翻译失败.\n"+JSON.stringify(r))}}}class a extends n{constructor(){super(...arguments);this.name="Google";this.link="https://translate.google.com/";this.apiUrl="https://translate.google.com/translate_a/single"}async translate(t,e){const n="zh";let s=_.get(e,"targetLanguage",n);if(s.includes("-")&&s!==n){s=s.substring(0,s.indexOf("-"))}const a=await Ajax.monkey({url:`${this.apiUrl}?${Object.entries({client:"gtx",sl:"auto",tl:s,dt:"t",q:encodeURIComponent(t)}).map(([t,e])=>`${t}=${e}`).join("&")}`,method:"GET",headers:{"User-Agent":UserAgent},responseType:"json"});console.log(_.flattenDeep(a),a,a[0].map(t=>t[0]).join("\n"));const r=a[0].map(t=>t[0]).join("");return r}}class r extends a{constructor(){super(...arguments);this.link="https://translate.google.cn/";this.apiUrl="https://translate.google.cn/translate_a/single"}}const o=()=>{switch(t.feedsTranslateProvider){default:case"Bing":return new s;case"Google":return new a;case"GoogleCN":return new r}};return{export:{getTranslator:o}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/ffmpeg-support.min.js"] = (()=>{return(e,t)=>{const n=[".mp4",".m4a"];const r=(e,t,n)=>{if(e<2){return null}const r=[];for(let s=1;s<=e;s++){let e=` - ${s}`;if(n.includes(".m4a")){e=""}const l=escapeFilename(`${t}${e}${n[s-1]}`).replace(/'/g,"'\\''");r.push(`file '${l}'`)}return r.join("\n")};const s=(e,t)=>{const r=e=>e.fragments.length>1;const s=e.filter(r);if(s.length===0){return null}const l=new Map;s.forEach(e=>{l.set(escapeFilename(`ffmpeg-files-${e.title}.txt`),e.fragments.map((r,s)=>{let l=` - ${s+1}`;if(t===true){l=""}const a=escapeFilename(`${e.title}${l}${t===true?n[s]:t}`).replace(/'/g,"'\\''");return`file '${a}'`}).join("\n"))});return l};const l=(e,t)=>{const r=[];e.forEach(e=>{e.fragments.forEach((s,l)=>{let a="";if(e.fragments.length>1&&t!==true){a=` - ${l+1}`}const c=escapeFilename(`${e.title}${a}${t===true?n[l]:t}`).replace(/'/g,"'\\''");r.push(`file '${c}'`)})});return r.join("\n")};return{export:{getFragmentsList:r,getBatchFragmentsList:s,getBatchEpisodesList:l}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/fill-with-comments.min.js"] = (()=>{return(t,e)=>{const n="fill-with-comments-style";const l=t=>{};return{export:{fillWithComments:l}}}})(); diff --git a/min/bundle.json b/min/bundle.json index 6ded1093d..00b95f919 100644 --- a/min/bundle.json +++ b/min/bundle.json @@ -80,7 +80,7 @@ "feeds-filter.min.js": "10557E498B8BADA3C1C03E8C1DCD6FB24DBA2DA27A5A03BD861054F7E2989D46", "feeds-filter-card.vue.min.js": "86697BD2E1FAB99A7C3402192CFDDFF047BCF5826238EBDDFC318A54D3C6229D", "feeds-translate.min.css": "F2846C8252A7564A28BF8949299E11896C2B46BDA6A88FFB616B1F3F18E07CD8", - "feeds-translate.min.js": "69D53B78FFC5C2E315AE276E7C297064E1BBE349D53AA208B9C3BC45DE2CD7DE", + "feeds-translate.min.js": "A9ABEEF9220F229B502D286A0A322830843A48ECEDDBA863B23EA904A86B275B", "feeds-translate-providers.min.js": "D938CB5F6437AE4A38C1A9933F530B89168FB4E88DCA2289C46465059CE6473C", "ffmpeg-support.min.js": "B88C5BFDC1CC582CA25098D6BA47189FF628B7323EF9F90D4CFBC4E946648927", "fill-with-comments.min.js": "A32B6D4ADFA29C164F9675E07715EAC0A5CFE0BBB346735DD691BDA2D9F338C3", diff --git a/min/bundle.zip b/min/bundle.zip index ee7a7264dc6bf5be28011cae23ac898991bb5e66..bd42d3b57e130d6b47227b20fb1fc4f1af5f9f3d 100644 GIT binary patch delta 1574 zcmY*Zdu&r>6u*zLS8re2y}dnc*KXZtx2|0Wif+6HV`DrGs0;`rFxD<3vULswCNief zi7><%-4DYh>74N0y7ZcA0P&*r}#6+{iDY%_EP>mFrmGUpK zP*5zw77NW3yYUkriCxgGG)=sXC03d)#h*okmFzfSrJ!6{Z$MSOLBrox3W(m%KmiYmw^75CXC2I11FLb6Ooz0P^O)f~|jYr_}=={Tx$L;`1Z8ZYjLVrM8PV7{HE zN@=_CHm_Or`#8QW5?v2#l9T3sqpCiHL|EN#6rPKAwl=myOxSZ#Mx5_c%q52Q9D0eK z*3-IC zkw=r{+nZI~+pIcM5Fc?c#A|Cbi{Za^HsNF*)k@Yne3i%OxZD(!Jae$aO*SldQ%Dl$ zCpXpRrUjbNzN)b^+7W7wHNAja9+ul(H#y|R3pFfTsA&jzC?LPSSi_FRyekhgtLr`F zmae>qi^=FC9tyFFFL}Ab{L;*M7g%U51RyEdmIp=bG;pGZGB-kl^?ZG?h zreI|u1*8L=DbLAHn-Q4_mi>a4Z0aMJtiW%DjL9=y$v7R8ix`uS_oRN>R76kk@P1yz zlSqA|S;ntQI<`rAG1^9R`y&<|H!QjrU-C|T1y@JY%(VV;UBHW#x)bw!G)@eo$H&5G z#h{O-${T8Ryj-hOilec9CVD&O`*R0UYFgXj)WB~x`gK;ttrTy|kitZ_BQn0U}ErCf3^!lg{qhiEJ1@b7TA zlz$$;t>i9&u|X!|DXa}r9goDxAQQYFe+8NDGpGttwJG$jU0556bi~>tv2_o|^FWB) zS%>@ifZv@M%tmrygne8qvyAgy!<;fMc@5jj_=T;(`Q+{c*uxCyH7p6Ue7x8dX6I4- Xl3dn+%K2;&8p`SM^hI~gPzV}>V$c)}3(g9L2WJN(f=~6D-%XZ&YA&vL^hVi*@>vE$`T6c-b8A>w zetv#pA_jg|WA?7iG_zP(Bo-@6B#VtDiY1z5Dn@2eSX376{Mt<2GyH#G9G0k3&~Q(p za^X7itW+r8oNI958h}h44<4d8)~-(@L@PP@qRR)594Aq6^O5^7JQ~! zoT1ipV)$e+R>n}7XyL0A=oT40F_bQ};ARXh7E)oCxi1mxWd`4l<7|mtP78*d78MgR zM-IZRP^svQv!Ei*;=n$IohR|J!nf$Y<{H62okx%`}*1M z3xw+TvB%h+f@(YOZIsAk#IqrzGMa4g+8MSHRdy<1b;8c83*uKhEf-tY%lLGi>_mlw zGR4aqw> zsMvU~0@W^3(dXjko~u-_yHb%c>EiJfB0Y|G+k|>n;t$6acuy%BzKLT%>D07Eu*Gxa zb}WeJrGAUHcq%qmo>2@<{>CPszbQ1j(}T)Pg74`}U;_1`Ac1eX25nPn0AEe1Ui_25 ztg1ypA}td$?km`EpG#g*cyVVFx$81~pGZrDNGNmoQT3pTmGR&XRL|k9^v|KW#^tYt z4096Y8W*;PjAw|VQIo`Ddb2C!xzWXZf62+4TXsXW&3Jxpe3wLJf)SdVicFh~ngN^R zwRp6;DOb3Pvu;`;yn;zLm6`VC@Zq6(ngcuC%)r)U#@7omoJ=zQ(72&pMcPd0)wq*P zUW;#uW@rvHyjmaFxC8NSeurf#oY}GzXH!VW#YsI99qbW4Ku-!S5ij{P9Pn!@q*R{# zTK}}ALki=eT-~V69PLNgol2$Q`hKoZA3!c~C%>dJ)Ex+EG+*#xVH%Z)-J=?YM>QvQ zNsQ5*#xG~-*tCoAr9{@LS(`APMs~pkIh{#x4y)6tz;rHLH()G+yF8c9sM|4=PVMn7yt{ zX3$-fWio^2Vt*!;MzkN~tZjb(77WCZf`^%$){ZC-KZ)+cI))GHDmHmIO~u{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); \ No newline at end of file +(()=>{return(t,a)=>{(async()=>{if(!document.URL.startsWith("https://t.bilibili.com/")){return}a.applyStyle("feedsTranslateStyle");const{getTranslator:e}=await a.importAsync("feeds-translate-providers");const{feedsCardsManager:r}=await a.importAsync("feeds-apis");const n=await r.startWatching();if(!n){console.error("feedsCardsManager.startWatching() failed");return}const s=Vue.extend({template:`\n
\n
翻译
\n\n\n
{{result}}
\n
\n`,props:{card:{type:Object,required:true}},data(){return{result:"",working:false,activeTranslator:{}}},computed:{translated(){return this.result!==""}},methods:{async translate(){const a=this.card;try{this.working=true;const r=(await a.getText()).replace(/#(.+?)#/g,"");const n=this.activeTranslator=e();this.result=await n.translate(r,{targetLanguage:(()=>{if(t.i18n){return languageNameToCode[t.i18nLanguage]}if(t.feedsTranslateLanguage!==""){return t.feedsTranslateLanguage}return})()})}catch(t){logError(t)}finally{this.working=false}}}});const i=t=>{if(t.text.replace(/#(.+?)#/g,"")===""){return}const a=t.element.querySelector(".card-content");const e=new s({propsData:{card:_.clone(t)}}).$mount();a.insertAdjacentElement("beforeend",e.$el)};r.cards.forEach(i);r.addEventListener("addCard",t=>{i(t.detail)})})()}})(); \ No newline at end of file diff --git a/src/activity/feeds-translate/feeds-translate.ts b/src/activity/feeds-translate/feeds-translate.ts index 68df5f1ad..dbbbcf60e 100644 --- a/src/activity/feeds-translate/feeds-translate.ts +++ b/src/activity/feeds-translate/feeds-translate.ts @@ -66,7 +66,7 @@ import { FeedsCard } from '../feeds-apis' }, }) const injectButton = (card: FeedsCard) => { - if (card.text === '') { + if (card.text.replace(/#(.+?)#/g, '') === '') { return } const cardContent = card.element.querySelector('.card-content') as HTMLElement