mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Make it as reloadable
This commit is contained in:
parent
5a6d96106e
commit
ebcbd26970
@ -514,6 +514,7 @@ function loadResources()
|
||||
removeVideoTopMask: "removeVideoTopMask",
|
||||
hideOldEntry: "hideOldEntry",
|
||||
hideBangumiReviews: "hideBangumiReviews",
|
||||
videoScreenshot: "videoScreenshot",
|
||||
};
|
||||
for (const [key, data] of Object.entries(Resource.manifest))
|
||||
{
|
||||
@ -1100,7 +1101,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/remove-top-mask.min.js"] = (()=>{return(e,t)=>{const o=`.bilibili-player-video-top { display: none !important; }`;const n="remove-top-mask-style";const l=()=>t.applyStyleFromText(`<style id="${n}">${o}</style>`);const r=()=>{const e=document.getElementById(n);if(e){e.remove()}};l();return{reload:l,unload:r}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/remove-watermark.min.js"] = (()=>{return(i,l)=>{const n="bilibili-live-watermark";if($(`#${n}`).length===0){l.applyStyleFromText(`\n <style id='${n}'>\n .bilibili-live-player-video-logo\n {\n display: none !important;\n }\n </style>\n `)}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/screenshot.min.css"] = `.video-take-screenshot{padding:0 6px 0 18px;height:100%;cursor:pointer}.video-take-screenshot span{display:flex;align-items:center;justify-content:center;height:100%;width:100%}.video-take-screenshot i{font-size:20px;color:#fff;transform:scale(1);opacity:.9;transition:.4s cubic-bezier(.18,.89,.32,1.28)}.video-take-screenshot:hover i{transform:scale(1.05);opacity:1}.video-take-screenshot:active i{transform:scale(.95);opacity:1}.video-screenshot-container{position:relative;--screenshot-width:240px;--screenshot-width-negative:calc(0px - var(--screenshot-width));--screenshot-height:135px;--thumbnail-margin-vertical:12px;--thumbnail-margin-horizontal:24px;--screenshot-list-width:calc(2 * var(--thumbnail-margin-horizontal) + var(--screenshot-width))}.video-screenshot-batch{position:fixed;bottom:0;right:0;z-index:20000;display:flex;width:var(--screenshot-list-width);align-items:center;justify-content:space-evenly}.video-screenshot-batch button{background:#000c;color:#fff;border:none;border-radius:10px 10px 0 0;font-size:12pt;cursor:pointer;outline:0!important;padding:8px 12px;display:flex;justify-content:center;align-items:center}.video-screenshot-batch button i{font-size:14pt;margin-right:4px}.video-screenshot-container,.video-screenshot-container *{transition:.2s ease-out}.video-screenshot-list{position:fixed;top:0;right:0;z-index:20000;padding:var(--thumbnail-margin-vertical) 0;pointer-events:none;height:calc(100% - 2 * var(--thumbnail-margin-vertical) - 48px);width:var(--screenshot-list-width);overflow:auto}.video-screenshot-list *{pointer-events:initial}.video-screenshot-list-enter{opacity:0;transform:translateX(var(--screenshot-width-negative))}.video-screenshot-list-leave-to{opacity:0;transform:translateX(var(--screenshot-width))}.video-screenshot-thumbnail img{max-width:var(--screenshot-width);display:block;background-color:#000}.video-screenshot-thumbnail{margin:var(--thumbnail-margin-vertical) var(--thumbnail-margin-horizontal);position:relative;transition:.35s cubic-bezier(.18,.89,.32,1.28);width:var(--screenshot-width);height:var(--screenshot-height);background-color:#000}@keyframes spinner{to{transform:translate(-50%,-50%) rotate(360deg)}}.video-screenshot-thumbnail .loading::before{content:"";box-sizing:border-box;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(0);width:24px;height:24px;border-radius:50%;border:3px solid #8888;border-top-color:var(--theme-color);animation:.6s linear infinite spinner}.video-screenshot-thumbnail.video-screenshot-list-leave-active{position:absolute;transition:.35s cubic-bezier(.6,-.28,.74,.05)}.video-screenshot-thumbnail .mask{position:absolute;opacity:0;top:0;left:0;width:100%;height:100%;background:#0008;display:flex;justify-content:space-around;align-items:center;transition:none}.video-screenshot-thumbnail:hover .mask{opacity:1}.video-screenshot-thumbnail .mask button{background:#000a;color:#fff;border:none;border-radius:50%;font-size:24pt;cursor:pointer;width:48px;height:48px;outline:0!important}`;
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/screenshot.min.js"] = (()=>{return(e,t)=>{const{getFriendlyTitle:i}=t.import("title");const s=document.createElement("canvas");class n{constructor(e,t){this.url="";this.timeStamp=(new Date).getTime();this.video=e;this.videoTime=t;this.createUrl()}async createUrl(){s.width=this.video.videoWidth;s.height=this.video.videoHeight;const e=s.getContext("2d");if(e===null){throw new Error("视频截图失败: canvas 未创建或创建失败.")}e.drawImage(this.video,0,0);s.toBlob(e=>{if(e===null){throw new Error("视频截图失败: 创建 blob 失败.")}this.blob=e;this.url=URL.createObjectURL(e)},"image/png")}get filename(){return`${i()} @${this.videoTime.toString()}:${this.timeStamp.toString()}.png`}get id(){return this.videoTime.toString()+this.timeStamp.toString()}revoke(){URL.revokeObjectURL(this.url)}}const o=e=>{const t=e.currentTime;return new n(e,t)};t.applyStyle("videoScreenshotStyle");document.body.insertAdjacentHTML("beforeend",`\n <div class="video-screenshot-container">\n <transition-group class="video-screenshot-list" name="video-screenshot-list" tag="div">\n <video-screenshot v-for="screenshot of screenshots" v-bind:filename="screenshot.filename" v-bind:object-url="screenshot.url" v-on:discard="discard(screenshot)" v-bind:key="screenshot.id"></video-screenshot>\n </transition-group>\n <div v-show="showBatch" class="video-screenshot-batch">\n <a class="batch-link" style="display:none" v-bind:download="batchFilename"></a>\n <button v-on:click="saveAll">\n <i class="mdi mdi-content-save"></i>全部保存\n </button>\n <button v-on:click="discardAll">\n <i class="mdi mdi-delete-forever"></i>全部丢弃\n </button>\n </div>\n </div>\n`);Vue.component("video-screenshot",{props:{objectUrl:String,filename:String},template:`\n <div class="video-screenshot-thumbnail">\n <img v-if="objectUrl" v-bind:src="objectUrl">\n <div class="mask" v-if="objectUrl">\n <a class="link" style="display:none" v-bind:href="objectUrl" v-bind:download="filename"></a>\n <button v-on:click="save" class="save" title="保存"><i class="mdi mdi-content-save-outline"></i></button>\n <button v-on:click="discard" title="丢弃" class="discard"><i class="mdi mdi-delete-forever-outline"></i></button>\n </div>\n <div class="loading" v-else>\n </div>\n </div>`,methods:{discard(){this.$emit("discard")},save(){this.$el.querySelector(".link").click();this.discard()}}});const r=new Vue({el:".video-screenshot-container",data:{screenshots:[],batchFilename:i()+".zip"},methods:{discard(e){this.screenshots.splice(this.screenshots.indexOf(e),1);e.revoke()},async saveAll(){const e=new JSZip;this.screenshots.forEach(t=>{e.file(t.filename,t.blob,{date:new Date(t.timeStamp)})});const t=await e.generateAsync({type:"blob"});const i=this.$el.querySelector(".batch-link");i.href=URL.createObjectURL(t);i.click();URL.revokeObjectURL(i.href);i.href="";this.discardAll()},discardAll(){this.screenshots.forEach(e=>e.revoke());this.screenshots=[]}},computed:{showBatch(){return this.screenshots.length>=2}}});Observer.videoChange(async()=>{const e=await SpinQuery.select("#bofqi video");const t=await SpinQuery.select(".bilibili-player-video-time");if(e===null||t===null||document.querySelector(".video-take-screenshot")){return}t.insertAdjacentHTML("afterend",`\n <div class="video-take-screenshot" title="截图">\n <span><i class="mdi mdi-camera"></i></span>\n </div>`);const i=document.querySelector(".video-take-screenshot");if(i===null){return}i.addEventListener("click",()=>{const t=o(e);r.screenshots.unshift(t)})});return{export:{takeScreenshot:o,screenShotsList:r}}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/screenshot.min.js"] = (()=>{return(e,t)=>{const{getFriendlyTitle:s}=t.import("title");const i=document.createElement("canvas");class n{constructor(e,t){this.url="";this.timeStamp=(new Date).getTime();this.video=e;this.videoTime=t;this.createUrl()}async createUrl(){i.width=this.video.videoWidth;i.height=this.video.videoHeight;const e=i.getContext("2d");if(e===null){throw new Error("视频截图失败: canvas 未创建或创建失败.")}e.drawImage(this.video,0,0);i.toBlob(e=>{if(e===null){throw new Error("视频截图失败: 创建 blob 失败.")}this.blob=e;this.url=URL.createObjectURL(e)},"image/png")}get filename(){return`${s()} @${this.videoTime.toString()}:${this.timeStamp.toString()}.png`}get id(){return this.videoTime.toString()+this.timeStamp.toString()}revoke(){URL.revokeObjectURL(this.url)}}const o=e=>{const t=e.currentTime;return new n(e,t)};t.applyStyle("videoScreenshotStyle");document.body.insertAdjacentHTML("beforeend",`\n <div class="video-screenshot-container">\n <transition-group class="video-screenshot-list" name="video-screenshot-list" tag="div">\n <video-screenshot v-for="screenshot of screenshots" v-bind:filename="screenshot.filename" v-bind:object-url="screenshot.url" v-on:discard="discard(screenshot)" v-bind:key="screenshot.id"></video-screenshot>\n </transition-group>\n <div v-show="showBatch" class="video-screenshot-batch">\n <a class="batch-link" style="display:none" v-bind:download="batchFilename"></a>\n <button v-on:click="saveAll">\n <i class="mdi mdi-content-save"></i>全部保存\n </button>\n <button v-on:click="discardAll">\n <i class="mdi mdi-delete-forever"></i>全部丢弃\n </button>\n </div>\n </div>\n`);Vue.component("video-screenshot",{props:{objectUrl:String,filename:String},template:`\n <div class="video-screenshot-thumbnail">\n <img v-if="objectUrl" v-bind:src="objectUrl">\n <div class="mask" v-if="objectUrl">\n <a class="link" style="display:none" v-bind:href="objectUrl" v-bind:download="filename"></a>\n <button v-on:click="save" class="save" title="保存"><i class="mdi mdi-content-save-outline"></i></button>\n <button v-on:click="discard" title="丢弃" class="discard"><i class="mdi mdi-delete-forever-outline"></i></button>\n </div>\n <div class="loading" v-else>\n </div>\n </div>`,methods:{discard(){this.$emit("discard")},save(){this.$el.querySelector(".link").click();this.discard()}}});const r=new Vue({el:".video-screenshot-container",data:{screenshots:[],batchFilename:s()+".zip"},methods:{discard(e){this.screenshots.splice(this.screenshots.indexOf(e),1);e.revoke()},async saveAll(){const e=new JSZip;this.screenshots.forEach(t=>{e.file(t.filename,t.blob,{date:new Date(t.timeStamp)})});const t=await e.generateAsync({type:"blob"});const s=this.$el.querySelector(".batch-link");s.href=URL.createObjectURL(t);s.click();URL.revokeObjectURL(s.href);s.href="";this.discardAll()},discardAll(){this.screenshots.forEach(e=>e.revoke());this.screenshots=[]}},computed:{showBatch(){return this.screenshots.length>=2}}});Observer.videoChange(async()=>{const e=await SpinQuery.select("#bofqi video");const t=await SpinQuery.select(".bilibili-player-video-time");if(e===null||t===null||document.querySelector(".video-take-screenshot")){return}t.insertAdjacentHTML("afterend",`\n <div class="video-take-screenshot" title="截图">\n <span><i class="mdi mdi-camera"></i></span>\n </div>`);const s=document.querySelector(".video-take-screenshot");if(s===null){return}s.addEventListener("click",()=>{const t=o(e);r.screenshots.unshift(t)})});return{export:{takeScreenshot:o,screenShotsList:r},unload:()=>document.querySelectorAll(".video-take-screenshot,.video-screenshot-container").forEach(e=>e.style.display="none"),reload:()=>document.querySelectorAll(".video-take-screenshot,.video-screenshot-container").forEach(e=>e.style.display="flex")}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/scrollbar.min.css"] = `::-webkit-scrollbar{width:5px!important;height:5px!important}::-webkit-scrollbar-corner,::-webkit-scrollbar-track{background:0 0!important}::-webkit-resizer,::-webkit-scrollbar-thumb{background:#aaa}::-webkit-scrollbar-thumb:hover{background:#888}*{scrollbar-color:#aaa transparent;scrollbar-width:thin!important}`;
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-search.min.js"] = (()=>{return(t,e)=>{class s{constructor(){this.input=document.querySelector(".gui-settings-search");const t=[...document.querySelectorAll(".gui-settings-content>ul>li")];const e=t=>e=>e.classList.contains("category")===t;this.categories=t.filter(e(true));this.items=t.filter(e(false));this.importToolTips().then(()=>this.input.addEventListener("input",()=>this.keywordChange()))}async importToolTips(){if(typeof getI18nKey==="undefined"){console.error("请更新脚本后再使用设置搜索功能.");return}const{toolTips:t}=await e.importAsync(`settings-tooltip.${getI18nKey()}`);this.toolTips=t}keywordChange(){const t=this.input.value.trim();if(!t){this.categories.concat(this.items).forEach(t=>t.classList.add("folded"));return}this.items.forEach(e=>{const s=e.querySelector("input").getAttribute("key");const i=Resource.displayNames[s]+this.toolTips.get(s).replace(/<.*>|<\/.*>/g,"");if(i.includes(t)){e.classList.remove("folded")}else{e.classList.add("folded")}});this.foldCategories()}foldCategories(){for(const e of this.categories){function t(){let t=e.nextElementSibling;while(t!==null&&!t.classList.contains("category")){if(!t.classList.contains("folded")){return"remove"}t=t.nextElementSibling}return"add"}e.classList[t()]("folded")}}}return{export:{SettingsSearch:s}}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-side-bar.min.js"] = (()=>{return(e,i)=>{if(document.querySelector(".gui-settings-icon-panel")===null){document.body.insertAdjacentHTML("beforeend",`\n <div class='gui-settings-icon-panel icons-enabled'>\n <div class='gui-settings-widgets' title='附加功能'>\n <i class="icon-widgets"></i>\n </div>\n <div class='gui-settings' title='设置'>\n <i class="icon-settings"></i>\n </div>\n </div>`);document.querySelector(".gui-settings").addEventListener("click",e=>{if(e.shiftKey===false){document.querySelectorAll(".gui-settings-box,.gui-settings-mask").forEach(e=>e.classList.add("opened"))}else{document.querySelectorAll(".bilibili-evolved-about,.gui-settings-mask").forEach(e=>e.classList.add("opened"))}});document.querySelector(".gui-settings-widgets").addEventListener("click",()=>{document.querySelectorAll(".gui-settings-widgets-box,.gui-settings-mask").forEach(e=>e.classList.add("opened"))})}}})();
|
||||
|
||||
@ -514,6 +514,7 @@ function loadResources()
|
||||
removeVideoTopMask: "removeVideoTopMask",
|
||||
hideOldEntry: "hideOldEntry",
|
||||
hideBangumiReviews: "hideBangumiReviews",
|
||||
videoScreenshot: "videoScreenshot",
|
||||
};
|
||||
for (const [key, data] of Object.entries(Resource.manifest))
|
||||
{
|
||||
@ -1100,7 +1101,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/remove-top-mask.min.js"] = (()=>{return(e,t)=>{const o=`.bilibili-player-video-top { display: none !important; }`;const n="remove-top-mask-style";const l=()=>t.applyStyleFromText(`<style id="${n}">${o}</style>`);const r=()=>{const e=document.getElementById(n);if(e){e.remove()}};l();return{reload:l,unload:r}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/remove-watermark.min.js"] = (()=>{return(i,l)=>{const n="bilibili-live-watermark";if($(`#${n}`).length===0){l.applyStyleFromText(`\n <style id='${n}'>\n .bilibili-live-player-video-logo\n {\n display: none !important;\n }\n </style>\n `)}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/screenshot.min.css"] = `.video-take-screenshot{padding:0 6px 0 18px;height:100%;cursor:pointer}.video-take-screenshot span{display:flex;align-items:center;justify-content:center;height:100%;width:100%}.video-take-screenshot i{font-size:20px;color:#fff;transform:scale(1);opacity:.9;transition:.4s cubic-bezier(.18,.89,.32,1.28)}.video-take-screenshot:hover i{transform:scale(1.05);opacity:1}.video-take-screenshot:active i{transform:scale(.95);opacity:1}.video-screenshot-container{position:relative;--screenshot-width:240px;--screenshot-width-negative:calc(0px - var(--screenshot-width));--screenshot-height:135px;--thumbnail-margin-vertical:12px;--thumbnail-margin-horizontal:24px;--screenshot-list-width:calc(2 * var(--thumbnail-margin-horizontal) + var(--screenshot-width))}.video-screenshot-batch{position:fixed;bottom:0;right:0;z-index:20000;display:flex;width:var(--screenshot-list-width);align-items:center;justify-content:space-evenly}.video-screenshot-batch button{background:#000c;color:#fff;border:none;border-radius:10px 10px 0 0;font-size:12pt;cursor:pointer;outline:0!important;padding:8px 12px;display:flex;justify-content:center;align-items:center}.video-screenshot-batch button i{font-size:14pt;margin-right:4px}.video-screenshot-container,.video-screenshot-container *{transition:.2s ease-out}.video-screenshot-list{position:fixed;top:0;right:0;z-index:20000;padding:var(--thumbnail-margin-vertical) 0;pointer-events:none;height:calc(100% - 2 * var(--thumbnail-margin-vertical) - 48px);width:var(--screenshot-list-width);overflow:auto}.video-screenshot-list *{pointer-events:initial}.video-screenshot-list-enter{opacity:0;transform:translateX(var(--screenshot-width-negative))}.video-screenshot-list-leave-to{opacity:0;transform:translateX(var(--screenshot-width))}.video-screenshot-thumbnail img{max-width:var(--screenshot-width);display:block;background-color:#000}.video-screenshot-thumbnail{margin:var(--thumbnail-margin-vertical) var(--thumbnail-margin-horizontal);position:relative;transition:.35s cubic-bezier(.18,.89,.32,1.28);width:var(--screenshot-width);height:var(--screenshot-height);background-color:#000}@keyframes spinner{to{transform:translate(-50%,-50%) rotate(360deg)}}.video-screenshot-thumbnail .loading::before{content:"";box-sizing:border-box;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(0);width:24px;height:24px;border-radius:50%;border:3px solid #8888;border-top-color:var(--theme-color);animation:.6s linear infinite spinner}.video-screenshot-thumbnail.video-screenshot-list-leave-active{position:absolute;transition:.35s cubic-bezier(.6,-.28,.74,.05)}.video-screenshot-thumbnail .mask{position:absolute;opacity:0;top:0;left:0;width:100%;height:100%;background:#0008;display:flex;justify-content:space-around;align-items:center;transition:none}.video-screenshot-thumbnail:hover .mask{opacity:1}.video-screenshot-thumbnail .mask button{background:#000a;color:#fff;border:none;border-radius:50%;font-size:24pt;cursor:pointer;width:48px;height:48px;outline:0!important}`;
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/screenshot.min.js"] = (()=>{return(e,t)=>{const{getFriendlyTitle:i}=t.import("title");const s=document.createElement("canvas");class n{constructor(e,t){this.url="";this.timeStamp=(new Date).getTime();this.video=e;this.videoTime=t;this.createUrl()}async createUrl(){s.width=this.video.videoWidth;s.height=this.video.videoHeight;const e=s.getContext("2d");if(e===null){throw new Error("视频截图失败: canvas 未创建或创建失败.")}e.drawImage(this.video,0,0);s.toBlob(e=>{if(e===null){throw new Error("视频截图失败: 创建 blob 失败.")}this.blob=e;this.url=URL.createObjectURL(e)},"image/png")}get filename(){return`${i()} @${this.videoTime.toString()}:${this.timeStamp.toString()}.png`}get id(){return this.videoTime.toString()+this.timeStamp.toString()}revoke(){URL.revokeObjectURL(this.url)}}const o=e=>{const t=e.currentTime;return new n(e,t)};t.applyStyle("videoScreenshotStyle");document.body.insertAdjacentHTML("beforeend",`\n <div class="video-screenshot-container">\n <transition-group class="video-screenshot-list" name="video-screenshot-list" tag="div">\n <video-screenshot v-for="screenshot of screenshots" v-bind:filename="screenshot.filename" v-bind:object-url="screenshot.url" v-on:discard="discard(screenshot)" v-bind:key="screenshot.id"></video-screenshot>\n </transition-group>\n <div v-show="showBatch" class="video-screenshot-batch">\n <a class="batch-link" style="display:none" v-bind:download="batchFilename"></a>\n <button v-on:click="saveAll">\n <i class="mdi mdi-content-save"></i>全部保存\n </button>\n <button v-on:click="discardAll">\n <i class="mdi mdi-delete-forever"></i>全部丢弃\n </button>\n </div>\n </div>\n`);Vue.component("video-screenshot",{props:{objectUrl:String,filename:String},template:`\n <div class="video-screenshot-thumbnail">\n <img v-if="objectUrl" v-bind:src="objectUrl">\n <div class="mask" v-if="objectUrl">\n <a class="link" style="display:none" v-bind:href="objectUrl" v-bind:download="filename"></a>\n <button v-on:click="save" class="save" title="保存"><i class="mdi mdi-content-save-outline"></i></button>\n <button v-on:click="discard" title="丢弃" class="discard"><i class="mdi mdi-delete-forever-outline"></i></button>\n </div>\n <div class="loading" v-else>\n </div>\n </div>`,methods:{discard(){this.$emit("discard")},save(){this.$el.querySelector(".link").click();this.discard()}}});const r=new Vue({el:".video-screenshot-container",data:{screenshots:[],batchFilename:i()+".zip"},methods:{discard(e){this.screenshots.splice(this.screenshots.indexOf(e),1);e.revoke()},async saveAll(){const e=new JSZip;this.screenshots.forEach(t=>{e.file(t.filename,t.blob,{date:new Date(t.timeStamp)})});const t=await e.generateAsync({type:"blob"});const i=this.$el.querySelector(".batch-link");i.href=URL.createObjectURL(t);i.click();URL.revokeObjectURL(i.href);i.href="";this.discardAll()},discardAll(){this.screenshots.forEach(e=>e.revoke());this.screenshots=[]}},computed:{showBatch(){return this.screenshots.length>=2}}});Observer.videoChange(async()=>{const e=await SpinQuery.select("#bofqi video");const t=await SpinQuery.select(".bilibili-player-video-time");if(e===null||t===null||document.querySelector(".video-take-screenshot")){return}t.insertAdjacentHTML("afterend",`\n <div class="video-take-screenshot" title="截图">\n <span><i class="mdi mdi-camera"></i></span>\n </div>`);const i=document.querySelector(".video-take-screenshot");if(i===null){return}i.addEventListener("click",()=>{const t=o(e);r.screenshots.unshift(t)})});return{export:{takeScreenshot:o,screenShotsList:r}}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/screenshot.min.js"] = (()=>{return(e,t)=>{const{getFriendlyTitle:s}=t.import("title");const i=document.createElement("canvas");class n{constructor(e,t){this.url="";this.timeStamp=(new Date).getTime();this.video=e;this.videoTime=t;this.createUrl()}async createUrl(){i.width=this.video.videoWidth;i.height=this.video.videoHeight;const e=i.getContext("2d");if(e===null){throw new Error("视频截图失败: canvas 未创建或创建失败.")}e.drawImage(this.video,0,0);i.toBlob(e=>{if(e===null){throw new Error("视频截图失败: 创建 blob 失败.")}this.blob=e;this.url=URL.createObjectURL(e)},"image/png")}get filename(){return`${s()} @${this.videoTime.toString()}:${this.timeStamp.toString()}.png`}get id(){return this.videoTime.toString()+this.timeStamp.toString()}revoke(){URL.revokeObjectURL(this.url)}}const o=e=>{const t=e.currentTime;return new n(e,t)};t.applyStyle("videoScreenshotStyle");document.body.insertAdjacentHTML("beforeend",`\n <div class="video-screenshot-container">\n <transition-group class="video-screenshot-list" name="video-screenshot-list" tag="div">\n <video-screenshot v-for="screenshot of screenshots" v-bind:filename="screenshot.filename" v-bind:object-url="screenshot.url" v-on:discard="discard(screenshot)" v-bind:key="screenshot.id"></video-screenshot>\n </transition-group>\n <div v-show="showBatch" class="video-screenshot-batch">\n <a class="batch-link" style="display:none" v-bind:download="batchFilename"></a>\n <button v-on:click="saveAll">\n <i class="mdi mdi-content-save"></i>全部保存\n </button>\n <button v-on:click="discardAll">\n <i class="mdi mdi-delete-forever"></i>全部丢弃\n </button>\n </div>\n </div>\n`);Vue.component("video-screenshot",{props:{objectUrl:String,filename:String},template:`\n <div class="video-screenshot-thumbnail">\n <img v-if="objectUrl" v-bind:src="objectUrl">\n <div class="mask" v-if="objectUrl">\n <a class="link" style="display:none" v-bind:href="objectUrl" v-bind:download="filename"></a>\n <button v-on:click="save" class="save" title="保存"><i class="mdi mdi-content-save-outline"></i></button>\n <button v-on:click="discard" title="丢弃" class="discard"><i class="mdi mdi-delete-forever-outline"></i></button>\n </div>\n <div class="loading" v-else>\n </div>\n </div>`,methods:{discard(){this.$emit("discard")},save(){this.$el.querySelector(".link").click();this.discard()}}});const r=new Vue({el:".video-screenshot-container",data:{screenshots:[],batchFilename:s()+".zip"},methods:{discard(e){this.screenshots.splice(this.screenshots.indexOf(e),1);e.revoke()},async saveAll(){const e=new JSZip;this.screenshots.forEach(t=>{e.file(t.filename,t.blob,{date:new Date(t.timeStamp)})});const t=await e.generateAsync({type:"blob"});const s=this.$el.querySelector(".batch-link");s.href=URL.createObjectURL(t);s.click();URL.revokeObjectURL(s.href);s.href="";this.discardAll()},discardAll(){this.screenshots.forEach(e=>e.revoke());this.screenshots=[]}},computed:{showBatch(){return this.screenshots.length>=2}}});Observer.videoChange(async()=>{const e=await SpinQuery.select("#bofqi video");const t=await SpinQuery.select(".bilibili-player-video-time");if(e===null||t===null||document.querySelector(".video-take-screenshot")){return}t.insertAdjacentHTML("afterend",`\n <div class="video-take-screenshot" title="截图">\n <span><i class="mdi mdi-camera"></i></span>\n </div>`);const s=document.querySelector(".video-take-screenshot");if(s===null){return}s.addEventListener("click",()=>{const t=o(e);r.screenshots.unshift(t)})});return{export:{takeScreenshot:o,screenShotsList:r},unload:()=>document.querySelectorAll(".video-take-screenshot,.video-screenshot-container").forEach(e=>e.style.display="none"),reload:()=>document.querySelectorAll(".video-take-screenshot,.video-screenshot-container").forEach(e=>e.style.display="flex")}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/scrollbar.min.css"] = `::-webkit-scrollbar{width:5px!important;height:5px!important}::-webkit-scrollbar-corner,::-webkit-scrollbar-track{background:0 0!important}::-webkit-resizer,::-webkit-scrollbar-thumb{background:#aaa}::-webkit-scrollbar-thumb:hover{background:#888}*{scrollbar-color:#aaa transparent;scrollbar-width:thin!important}`;
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-search.min.js"] = (()=>{return(t,e)=>{class s{constructor(){this.input=document.querySelector(".gui-settings-search");const t=[...document.querySelectorAll(".gui-settings-content>ul>li")];const e=t=>e=>e.classList.contains("category")===t;this.categories=t.filter(e(true));this.items=t.filter(e(false));this.importToolTips().then(()=>this.input.addEventListener("input",()=>this.keywordChange()))}async importToolTips(){if(typeof getI18nKey==="undefined"){console.error("请更新脚本后再使用设置搜索功能.");return}const{toolTips:t}=await e.importAsync(`settings-tooltip.${getI18nKey()}`);this.toolTips=t}keywordChange(){const t=this.input.value.trim();if(!t){this.categories.concat(this.items).forEach(t=>t.classList.add("folded"));return}this.items.forEach(e=>{const s=e.querySelector("input").getAttribute("key");const i=Resource.displayNames[s]+this.toolTips.get(s).replace(/<.*>|<\/.*>/g,"");if(i.includes(t)){e.classList.remove("folded")}else{e.classList.add("folded")}});this.foldCategories()}foldCategories(){for(const e of this.categories){function t(){let t=e.nextElementSibling;while(t!==null&&!t.classList.contains("category")){if(!t.classList.contains("folded")){return"remove"}t=t.nextElementSibling}return"add"}e.classList[t()]("folded")}}}return{export:{SettingsSearch:s}}}})();
|
||||
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-side-bar.min.js"] = (()=>{return(e,i)=>{if(document.querySelector(".gui-settings-icon-panel")===null){document.body.insertAdjacentHTML("beforeend",`\n <div class='gui-settings-icon-panel icons-enabled'>\n <div class='gui-settings-widgets' title='附加功能'>\n <i class="icon-widgets"></i>\n </div>\n <div class='gui-settings' title='设置'>\n <i class="icon-settings"></i>\n </div>\n </div>`);document.querySelector(".gui-settings").addEventListener("click",e=>{if(e.shiftKey===false){document.querySelectorAll(".gui-settings-box,.gui-settings-mask").forEach(e=>e.classList.add("opened"))}else{document.querySelectorAll(".bilibili-evolved-about,.gui-settings-mask").forEach(e=>e.classList.add("opened"))}});document.querySelector(".gui-settings-widgets").addEventListener("click",()=>{document.querySelectorAll(".gui-settings-widgets-box,.gui-settings-mask").forEach(e=>e.classList.add("opened"))})}}})();
|
||||
|
||||
@ -513,6 +513,7 @@ function loadResources()
|
||||
removeVideoTopMask: "removeVideoTopMask",
|
||||
hideOldEntry: "hideOldEntry",
|
||||
hideBangumiReviews: "hideBangumiReviews",
|
||||
videoScreenshot: "videoScreenshot",
|
||||
};
|
||||
for (const [key, data] of Object.entries(Resource.manifest))
|
||||
{
|
||||
|
||||
@ -513,6 +513,7 @@ function loadResources()
|
||||
removeVideoTopMask: "removeVideoTopMask",
|
||||
hideOldEntry: "hideOldEntry",
|
||||
hideBangumiReviews: "hideBangumiReviews",
|
||||
videoScreenshot: "videoScreenshot",
|
||||
};
|
||||
for (const [key, data] of Object.entries(Resource.manifest))
|
||||
{
|
||||
|
||||
@ -14,6 +14,7 @@ export function loadResources()
|
||||
removeVideoTopMask: "removeVideoTopMask",
|
||||
hideOldEntry: "hideOldEntry",
|
||||
hideBangumiReviews: "hideBangumiReviews",
|
||||
videoScreenshot: "videoScreenshot",
|
||||
};
|
||||
for (const [key, data] of Object.entries(Resource.manifest))
|
||||
{
|
||||
|
||||
2
min/screenshot.min.js
vendored
2
min/screenshot.min.js
vendored
@ -1 +1 @@
|
||||
(()=>{return(e,t)=>{const{getFriendlyTitle:i}=t.import("title");const s=document.createElement("canvas");class n{constructor(e,t){this.url="";this.timeStamp=(new Date).getTime();this.video=e;this.videoTime=t;this.createUrl()}async createUrl(){s.width=this.video.videoWidth;s.height=this.video.videoHeight;const e=s.getContext("2d");if(e===null){throw new Error("视频截图失败: canvas 未创建或创建失败.")}e.drawImage(this.video,0,0);s.toBlob(e=>{if(e===null){throw new Error("视频截图失败: 创建 blob 失败.")}this.blob=e;this.url=URL.createObjectURL(e)},"image/png")}get filename(){return`${i()} @${this.videoTime.toString()}:${this.timeStamp.toString()}.png`}get id(){return this.videoTime.toString()+this.timeStamp.toString()}revoke(){URL.revokeObjectURL(this.url)}}const o=e=>{const t=e.currentTime;return new n(e,t)};t.applyStyle("videoScreenshotStyle");document.body.insertAdjacentHTML("beforeend",`\n <div class="video-screenshot-container">\n <transition-group class="video-screenshot-list" name="video-screenshot-list" tag="div">\n <video-screenshot v-for="screenshot of screenshots" v-bind:filename="screenshot.filename" v-bind:object-url="screenshot.url" v-on:discard="discard(screenshot)" v-bind:key="screenshot.id"></video-screenshot>\n </transition-group>\n <div v-show="showBatch" class="video-screenshot-batch">\n <a class="batch-link" style="display:none" v-bind:download="batchFilename"></a>\n <button v-on:click="saveAll">\n <i class="mdi mdi-content-save"></i>全部保存\n </button>\n <button v-on:click="discardAll">\n <i class="mdi mdi-delete-forever"></i>全部丢弃\n </button>\n </div>\n </div>\n`);Vue.component("video-screenshot",{props:{objectUrl:String,filename:String},template:`\n <div class="video-screenshot-thumbnail">\n <img v-if="objectUrl" v-bind:src="objectUrl">\n <div class="mask" v-if="objectUrl">\n <a class="link" style="display:none" v-bind:href="objectUrl" v-bind:download="filename"></a>\n <button v-on:click="save" class="save" title="保存"><i class="mdi mdi-content-save-outline"></i></button>\n <button v-on:click="discard" title="丢弃" class="discard"><i class="mdi mdi-delete-forever-outline"></i></button>\n </div>\n <div class="loading" v-else>\n </div>\n </div>`,methods:{discard(){this.$emit("discard")},save(){this.$el.querySelector(".link").click();this.discard()}}});const r=new Vue({el:".video-screenshot-container",data:{screenshots:[],batchFilename:i()+".zip"},methods:{discard(e){this.screenshots.splice(this.screenshots.indexOf(e),1);e.revoke()},async saveAll(){const e=new JSZip;this.screenshots.forEach(t=>{e.file(t.filename,t.blob,{date:new Date(t.timeStamp)})});const t=await e.generateAsync({type:"blob"});const i=this.$el.querySelector(".batch-link");i.href=URL.createObjectURL(t);i.click();URL.revokeObjectURL(i.href);i.href="";this.discardAll()},discardAll(){this.screenshots.forEach(e=>e.revoke());this.screenshots=[]}},computed:{showBatch(){return this.screenshots.length>=2}}});Observer.videoChange(async()=>{const e=await SpinQuery.select("#bofqi video");const t=await SpinQuery.select(".bilibili-player-video-time");if(e===null||t===null||document.querySelector(".video-take-screenshot")){return}t.insertAdjacentHTML("afterend",`\n <div class="video-take-screenshot" title="截图">\n <span><i class="mdi mdi-camera"></i></span>\n </div>`);const i=document.querySelector(".video-take-screenshot");if(i===null){return}i.addEventListener("click",()=>{const t=o(e);r.screenshots.unshift(t)})});return{export:{takeScreenshot:o,screenShotsList:r}}}})();
|
||||
(()=>{return(e,t)=>{const{getFriendlyTitle:s}=t.import("title");const i=document.createElement("canvas");class n{constructor(e,t){this.url="";this.timeStamp=(new Date).getTime();this.video=e;this.videoTime=t;this.createUrl()}async createUrl(){i.width=this.video.videoWidth;i.height=this.video.videoHeight;const e=i.getContext("2d");if(e===null){throw new Error("视频截图失败: canvas 未创建或创建失败.")}e.drawImage(this.video,0,0);i.toBlob(e=>{if(e===null){throw new Error("视频截图失败: 创建 blob 失败.")}this.blob=e;this.url=URL.createObjectURL(e)},"image/png")}get filename(){return`${s()} @${this.videoTime.toString()}:${this.timeStamp.toString()}.png`}get id(){return this.videoTime.toString()+this.timeStamp.toString()}revoke(){URL.revokeObjectURL(this.url)}}const o=e=>{const t=e.currentTime;return new n(e,t)};t.applyStyle("videoScreenshotStyle");document.body.insertAdjacentHTML("beforeend",`\n <div class="video-screenshot-container">\n <transition-group class="video-screenshot-list" name="video-screenshot-list" tag="div">\n <video-screenshot v-for="screenshot of screenshots" v-bind:filename="screenshot.filename" v-bind:object-url="screenshot.url" v-on:discard="discard(screenshot)" v-bind:key="screenshot.id"></video-screenshot>\n </transition-group>\n <div v-show="showBatch" class="video-screenshot-batch">\n <a class="batch-link" style="display:none" v-bind:download="batchFilename"></a>\n <button v-on:click="saveAll">\n <i class="mdi mdi-content-save"></i>全部保存\n </button>\n <button v-on:click="discardAll">\n <i class="mdi mdi-delete-forever"></i>全部丢弃\n </button>\n </div>\n </div>\n`);Vue.component("video-screenshot",{props:{objectUrl:String,filename:String},template:`\n <div class="video-screenshot-thumbnail">\n <img v-if="objectUrl" v-bind:src="objectUrl">\n <div class="mask" v-if="objectUrl">\n <a class="link" style="display:none" v-bind:href="objectUrl" v-bind:download="filename"></a>\n <button v-on:click="save" class="save" title="保存"><i class="mdi mdi-content-save-outline"></i></button>\n <button v-on:click="discard" title="丢弃" class="discard"><i class="mdi mdi-delete-forever-outline"></i></button>\n </div>\n <div class="loading" v-else>\n </div>\n </div>`,methods:{discard(){this.$emit("discard")},save(){this.$el.querySelector(".link").click();this.discard()}}});const r=new Vue({el:".video-screenshot-container",data:{screenshots:[],batchFilename:s()+".zip"},methods:{discard(e){this.screenshots.splice(this.screenshots.indexOf(e),1);e.revoke()},async saveAll(){const e=new JSZip;this.screenshots.forEach(t=>{e.file(t.filename,t.blob,{date:new Date(t.timeStamp)})});const t=await e.generateAsync({type:"blob"});const s=this.$el.querySelector(".batch-link");s.href=URL.createObjectURL(t);s.click();URL.revokeObjectURL(s.href);s.href="";this.discardAll()},discardAll(){this.screenshots.forEach(e=>e.revoke());this.screenshots=[]}},computed:{showBatch(){return this.screenshots.length>=2}}});Observer.videoChange(async()=>{const e=await SpinQuery.select("#bofqi video");const t=await SpinQuery.select(".bilibili-player-video-time");if(e===null||t===null||document.querySelector(".video-take-screenshot")){return}t.insertAdjacentHTML("afterend",`\n <div class="video-take-screenshot" title="截图">\n <span><i class="mdi mdi-camera"></i></span>\n </div>`);const s=document.querySelector(".video-take-screenshot");if(s===null){return}s.addEventListener("click",()=>{const t=o(e);r.screenshots.unshift(t)})});return{export:{takeScreenshot:o,screenShotsList:r},unload:()=>document.querySelectorAll(".video-take-screenshot,.video-screenshot-container").forEach(e=>e.style.display="none"),reload:()=>document.querySelectorAll(".video-take-screenshot,.video-screenshot-container").forEach(e=>e.style.display="flex")}}})();
|
||||
@ -162,4 +162,8 @@ export default {
|
||||
takeScreenshot,
|
||||
screenShotsList,
|
||||
},
|
||||
unload: () => document.querySelectorAll(".video-take-screenshot,.video-screenshot-container")
|
||||
.forEach(it => it.style.display = "none"),
|
||||
reload: () => document.querySelectorAll(".video-take-screenshot,.video-screenshot-container")
|
||||
.forEach(it => it.style.display = "flex"),
|
||||
};
|
||||
|
||||
@ -187,4 +187,8 @@ export default {
|
||||
takeScreenshot,
|
||||
screenShotsList,
|
||||
},
|
||||
unload: () => document.querySelectorAll(".video-take-screenshot,.video-screenshot-container")
|
||||
.forEach(it => (it as HTMLElement).style.display = "none"),
|
||||
reload: () => document.querySelectorAll(".video-take-screenshot,.video-screenshot-container")
|
||||
.forEach(it => (it as HTMLElement).style.display = "flex"),
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user