mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Add loading message
This commit is contained in:
parent
1c9c19ef8c
commit
a844ce950b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
min/download-danmaku.min.js
vendored
2
min/download-danmaku.min.js
vendored
@ -1 +1 @@
|
||||
(()=>{return(n,t)=>{const e=t.attributes.videoInfo.export.DanmakuInfo;async function a(){const n=document.title.replace("_哔哩哔哩 (゜-゜)つロ 干杯~-bilibili","");const t=new e((unsafeWindow||window).cid);await t.fetchInfo();const a=new Blob([t.rawXML],{type:"text/plain"});const i=URL.createObjectURL(a);const o=$("#danmaku-link");const d=o.attr("href");if(d){URL.revokeObjectURL(d)}o.attr("download",`${n}.xml`).attr("href",i).get(0).click()}return{widget:{content:`\n <button\n class="gui-settings-flat-button"\n id="download-danmaku">\n <i class="icon-danmaku"></i>\n <span>下载弹幕</span>\n <a id="danmaku-link" style="display:none"></a>\n </button>`,condition:async()=>{let n=(unsafeWindow||window).aid;let t=(unsafeWindow||window).cid;if(n===undefined||t===undefined){const e=document.URL.match(/\/av(\d+)/);if(e&&e[1]){const a=await new VideoInfo(e[1]).fetchInfo();n=a.aid;t=a.cid}}return t!==undefined},success:()=>{const n=document.querySelector("#danmaku-link");$("#download-danmaku").on("click",t=>{if(t.target!==n){a()}})}}}}})();
|
||||
(()=>{return(n,t)=>{const e=t.attributes.videoInfo.export.DanmakuInfo;async function o(n){const t=document.title.replace("_哔哩哔哩 (゜-゜)つロ 干杯~-bilibili","");const o=new e((unsafeWindow||window).cid);await o.fetchInfo();const a=new Blob([o.rawXML],{type:"text/plain"});const i=URL.createObjectURL(a);const d=$("#danmaku-link");const c=d.attr("href");if(c){URL.revokeObjectURL(c)}clearTimeout(n);document.querySelector("#download-danmaku>span").innerHTML="下载弹幕";d.attr("download",`${t}.xml`).attr("href",i).get(0).click()}return{widget:{content:`\n <button\n class="gui-settings-flat-button"\n id="download-danmaku">\n <i class="icon-danmaku"></i>\n <span>下载弹幕</span>\n <a id="danmaku-link" style="display:none"></a>\n </button>`,condition:async()=>{let n=(unsafeWindow||window).aid;let t=(unsafeWindow||window).cid;if(n===undefined||t===undefined){const e=document.URL.match(/\/av(\d+)/);if(e&&e[1]){const o=await new VideoInfo(e[1]).fetchInfo();n=o.aid;t=o.cid}}return t!==undefined},success:()=>{const n=document.querySelector("#danmaku-link");$("#download-danmaku").on("click",t=>{if(t.target!==n){const n=setTimeout(()=>document.querySelector("#download-danmaku>span").innerHTML="请稍侯...",200);o(n)}})}}}}})();
|
||||
@ -3,7 +3,7 @@
|
||||
return (settings, resources) =>
|
||||
{
|
||||
const DanmakuInfo = resources.attributes.videoInfo.export.DanmakuInfo;
|
||||
async function downloadDanmaku()
|
||||
async function downloadDanmaku(timeout)
|
||||
{
|
||||
const title = document.title.replace("_哔哩哔哩 (゜-゜)つロ 干杯~-bilibili", "");
|
||||
const danmaku = new DanmakuInfo((unsafeWindow || window).cid);
|
||||
@ -18,6 +18,8 @@
|
||||
{
|
||||
URL.revokeObjectURL(oldUrl);
|
||||
}
|
||||
clearTimeout(timeout);
|
||||
document.querySelector("#download-danmaku>span").innerHTML = "下载弹幕";
|
||||
link.attr("download", `${title}.xml`).attr("href", url).get(0).click();
|
||||
}
|
||||
return {
|
||||
@ -53,7 +55,10 @@
|
||||
{
|
||||
if (e.target !== link)
|
||||
{
|
||||
downloadDanmaku();
|
||||
const timeout = setTimeout(
|
||||
() => document.querySelector("#download-danmaku>span").innerHTML = "请稍侯...",
|
||||
200);
|
||||
downloadDanmaku(timeout);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user