mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Add jsDelivr CDN support
This commit is contained in:
parent
0e15376561
commit
60a94eca34
1
@types/global/index.d.ts
vendored
1
@types/global/index.d.ts
vendored
@ -213,6 +213,7 @@ declare global {
|
|||||||
static displayNames: object
|
static displayNames: object
|
||||||
static manifest: object
|
static manifest: object
|
||||||
static root: string
|
static root: string
|
||||||
|
static cdnRoot: string
|
||||||
}
|
}
|
||||||
class ResourceManager {
|
class ResourceManager {
|
||||||
import(compnentName: string): any
|
import(compnentName: string): any
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -17,6 +17,7 @@ namespace BilibiliEvolved.Build
|
|||||||
{
|
{
|
||||||
{ @"Bilibili-Evolved/preview", @"Bilibili-Evolved/master" },
|
{ @"Bilibili-Evolved/preview", @"Bilibili-Evolved/master" },
|
||||||
{ @"Bilibili-Evolved/raw/preview", @"Bilibili-Evolved/raw/master" },
|
{ @"Bilibili-Evolved/raw/preview", @"Bilibili-Evolved/raw/master" },
|
||||||
|
{ @"https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/bilibili-evolved.preview.user.js", @"https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@master/bilibili-evolved.preview.user.js" },
|
||||||
{ SourcePath, OutputPath },
|
{ SourcePath, OutputPath },
|
||||||
{ @"Bilibili Evolved (Preview)", @"Bilibili Evolved" },
|
{ @"Bilibili Evolved (Preview)", @"Bilibili Evolved" },
|
||||||
{ Description.Preview, Description.Master },
|
{ Description.Preview, Description.Master },
|
||||||
|
|||||||
Binary file not shown.
@ -130,7 +130,7 @@
|
|||||||
"no-banner.min.css": "DA096F94E7FA26992F3F71245E704D69A1C222D0ADA6F1990FA5D948507CE15F",
|
"no-banner.min.css": "DA096F94E7FA26992F3F71245E704D69A1C222D0ADA6F1990FA5D948507CE15F",
|
||||||
"no-live-autoplay.min.js": "EE4E05A1A2BCB96EA50C2F3891AC3EBBE65D2660103A244DB0297CC5F05D9BAE",
|
"no-live-autoplay.min.js": "EE4E05A1A2BCB96EA50C2F3891AC3EBBE65D2660103A244DB0297CC5F05D9BAE",
|
||||||
"no-mini-video-autoplay.min.js": "13B755C0EE0CA018AE65251E168BAF3395FEA2EB4FAD6949AADD752F61B8819B",
|
"no-mini-video-autoplay.min.js": "13B755C0EE0CA018AE65251E168BAF3395FEA2EB4FAD6949AADD752F61B8819B",
|
||||||
"notify-new-version.min.js": "B657B4A67D791FC413E1DBF2BBC59A79EE453582F44F17BF9157D927891BAE96",
|
"notify-new-version.min.js": "CD9FBE0E5FDE3ED9FA411BE5388E0E9A9C0C4A415F500E9A45B869F8041643CF",
|
||||||
"old.min.css": "4C8C918BEBE59E9EE19D5E383234767EE2A2F1DB72E86F0C9F9CE01F26DD193C",
|
"old.min.css": "4C8C918BEBE59E9EE19D5E383234767EE2A2F1DB72E86F0C9F9CE01F26DD193C",
|
||||||
"old-tweets.min.js": "387152B26384B0900985F527112841CC00A48F507EAA8FA634D13FFA83447A72",
|
"old-tweets.min.js": "387152B26384B0900985F527112841CC00A48F507EAA8FA634D13FFA83447A72",
|
||||||
"online-info-row.vue.min.js": "4707798C1C08F1704142BAEFE43CB4DA3060352A66B0F1A6BFE5A77F8486A195",
|
"online-info-row.vue.min.js": "4707798C1C08F1704142BAEFE43CB4DA3060352A66B0F1A6BFE5A77F8486A195",
|
||||||
|
|||||||
BIN
min/bundle.zip
BIN
min/bundle.zip
Binary file not shown.
2
min/notify-new-version.min.js
vendored
2
min/notify-new-version.min.js
vendored
@ -1 +1 @@
|
|||||||
(()=>{return(e,t)=>{const n={less:-1,equal:0,greater:1,incomparable:NaN};class s{constructor(e){if(!/^[\d\.]+$/.test(e)){throw new Error("Invalid version string")}this.parts=e.split(".").map(e=>parseInt(e));this.versionString=e}compareTo(e){for(let t=0;t<this.parts.length;++t){if(e.parts.length===t){return n.greater}if(this.parts[t]===e.parts[t]){continue}if(this.parts[t]>e.parts[t]){return n.greater}return n.less}if(this.parts.length!==e.parts.length){return n.less}return n.equal}greaterThan(e){return this.compareTo(e)===n.greater}lessThan(e){return this.compareTo(e)===n.less}equals(e){return this.compareTo(e)===n.equal}}async function r(){if(typeof offlineData!=="undefined"||isIframe()){return false}try{const t=await Ajax.monkey({url:Resource.root+"version.txt"});const n=new s(t);const r=new s(e.currentVersion);const i=n.greaterThan(r);if(i){const t=`新版本<span>${n.versionString}</span>已发布. <a id="new-version-link" class="link" href="${e.latestVersionLink}">安装</a><a class="link" target="_blank" href="https://github.com/the1812/Bilibili-Evolved/releases">查看</a>`;const s=Toast.info(t,"检查更新");SpinQuery.select("#new-version-link").then(e=>e.addEventListener("click",()=>{s&&s.dismiss()}))}return i}catch(e){return false}}return{widget:{content:`\n<button class="gui-settings-flat-button" id="new-version-update">\n<a href="${e.latestVersionLink}" style="display:none"></a>\n<i class="icon-update"></i>\n<span>安装更新</span>\n</button>\n<button class="gui-settings-flat-button" id="new-version-info">\n<a target="blank" style="display:none" href="https://github.com/the1812/Bilibili-Evolved/releases"></a>\n<i class="icon-info"></i>\n<span>查看更新</span>\n</button>\n`,condition:r,success:()=>{document.querySelector("#new-version-update").addEventListener("click",e=>{if(e.target.nodeName.toLowerCase()!=="a"){document.querySelector("#new-version-update a").click()}});document.querySelector("#new-version-info").addEventListener("click",e=>{if(e.target.nodeName.toLowerCase()!=="a"){document.querySelector("#new-version-info a").click()}})}}}}})();
|
(()=>{return(e,t)=>{const n={less:-1,equal:0,greater:1,incomparable:NaN};class s{constructor(e){if(!/^[\d\.]+$/.test(e)){throw new Error("Invalid version string")}this.parts=e.split(".").map(e=>parseInt(e));this.versionString=e}compareTo(e){for(let t=0;t<this.parts.length;++t){if(e.parts.length===t){return n.greater}if(this.parts[t]===e.parts[t]){continue}if(this.parts[t]>e.parts[t]){return n.greater}return n.less}if(this.parts.length!==e.parts.length){return n.less}return n.equal}greaterThan(e){return this.compareTo(e)===n.greater}lessThan(e){return this.compareTo(e)===n.less}equals(e){return this.compareTo(e)===n.equal}}async function r(){if(typeof offlineData!=="undefined"||isIframe()){return false}try{const t=await Ajax.monkey({url:Resource.cdnRoot||Resource.root+"version.txt"});const n=new s(t);const r=new s(e.currentVersion);const i=n.greaterThan(r);if(i){const t=`新版本<span>${n.versionString}</span>已发布. <a id="new-version-link" class="link" href="${e.latestVersionLink}">安装</a><a class="link" target="_blank" href="https://github.com/the1812/Bilibili-Evolved/releases">查看</a>`;const s=Toast.info(t,"检查更新");SpinQuery.select("#new-version-link").then(e=>e.addEventListener("click",()=>{s&&s.dismiss()}))}return i}catch(e){return false}}return{widget:{content:`\n<button class="gui-settings-flat-button" id="new-version-update">\n<a href="${e.latestVersionLink}" style="display:none"></a>\n<i class="icon-update"></i>\n<span>安装更新</span>\n</button>\n<button class="gui-settings-flat-button" id="new-version-info">\n<a target="blank" style="display:none" href="https://github.com/the1812/Bilibili-Evolved/releases"></a>\n<i class="icon-info"></i>\n<span>查看更新</span>\n</button>\n`,condition:r,success:()=>{document.querySelector("#new-version-update").addEventListener("click",e=>{if(e.target.nodeName.toLowerCase()!=="a"){document.querySelector("#new-version-update a").click()}});document.querySelector("#new-version-info").addEventListener("click",e=>{if(e.target.nodeName.toLowerCase()!=="a"){document.querySelector("#new-version-info a").click()}})}}}}})();
|
||||||
@ -1,14 +1,14 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved (Preview)
|
// @name Bilibili Evolved (Preview)
|
||||||
// @version 1.9.24
|
// @version 1.9.25
|
||||||
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
|
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
||||||
// @license MIT
|
// @license MIT
|
||||||
// @match *://*.bilibili.com/*
|
// @match *://*.bilibili.com/*
|
||||||
// @run-at document-start
|
// @run-at document-start
|
||||||
// @updateURL https://github.com/the1812/Bilibili-Evolved/raw/preview/bilibili-evolved.preview.user.js
|
// @updateURL https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/bilibili-evolved.preview.user.js
|
||||||
// @downloadURL https://github.com/the1812/Bilibili-Evolved/raw/preview/bilibili-evolved.preview.user.js
|
// @downloadURL https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/bilibili-evolved.preview.user.js
|
||||||
// @supportURL https://github.com/the1812/Bilibili-Evolved/issues
|
// @supportURL https://github.com/the1812/Bilibili-Evolved/issues
|
||||||
// @homepage https://github.com/the1812/Bilibili-Evolved
|
// @homepage https://github.com/the1812/Bilibili-Evolved
|
||||||
// @grant unsafeWindow
|
// @grant unsafeWindow
|
||||||
@ -23,6 +23,7 @@
|
|||||||
// @grant GM.info
|
// @grant GM.info
|
||||||
// @grant GM.xmlHttpRequest
|
// @grant GM.xmlHttpRequest
|
||||||
// @connect raw.githubusercontent.com
|
// @connect raw.githubusercontent.com
|
||||||
|
// @connect cdn.jsdelivr.net
|
||||||
// @connect *
|
// @connect *
|
||||||
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
|
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
|
||||||
// @require https://code.jquery.com/jquery-3.4.0.min.js
|
// @require https://code.jquery.com/jquery-3.4.0.min.js
|
||||||
@ -30,8 +31,8 @@
|
|||||||
// @require https://cdn.bootcss.com/jszip/3.1.5/jszip.min.js
|
// @require https://cdn.bootcss.com/jszip/3.1.5/jszip.min.js
|
||||||
// @require https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js
|
// @require https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js
|
||||||
// @require https://unpkg.com/vuex@3.1.2/dist/vuex.js
|
// @require https://unpkg.com/vuex@3.1.2/dist/vuex.js
|
||||||
// @icon https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/logo-small.png
|
// @icon https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/images/logo-small.png
|
||||||
// @icon64 https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/logo.png
|
// @icon64 https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/images/logo.png
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
Vue.config.devtools = false
|
Vue.config.devtools = false
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
export function loadResources () {
|
export function loadResources () {
|
||||||
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/'
|
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/'
|
||||||
|
Resource.cdnRoot = 'https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/'
|
||||||
Resource.all = {}
|
Resource.all = {}
|
||||||
Resource.displayNames = {}
|
Resource.displayNames = {}
|
||||||
// Resource.reloadables = [
|
// Resource.reloadables = [
|
||||||
|
|||||||
@ -243,7 +243,7 @@ export class ResourceManager {
|
|||||||
// return hashHex
|
// return hashHex
|
||||||
// }
|
// }
|
||||||
// if (fullDownload) {
|
// if (fullDownload) {
|
||||||
const url = Resource.root + 'min/bundle.zip'
|
const url = (Resource.cdnRoot || Resource.root) + 'min/bundle.zip'
|
||||||
const zip = new JSZip()
|
const zip = new JSZip()
|
||||||
let isTimeout = true
|
let isTimeout = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@ -46,7 +46,7 @@ async function checkNewVersion () {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const latestVersionText = await Ajax.monkey({ url: Resource.root + 'version.txt' })
|
const latestVersionText = await Ajax.monkey({ url: Resource.cdnRoot || Resource.root + 'version.txt' })
|
||||||
const latestVersion = new Version(latestVersionText)
|
const latestVersion = new Version(latestVersionText)
|
||||||
const currentVersion = new Version(settings.currentVersion)
|
const currentVersion = new Version(settings.currentVersion)
|
||||||
const hasNewVersion = latestVersion.greaterThan(currentVersion)
|
const hasNewVersion = latestVersion.greaterThan(currentVersion)
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
1.9.24
|
1.9.25
|
||||||
Loading…
Reference in New Issue
Block a user