mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Merge branch 'preview' of https://github.com/the1812/Bilibili-Evolved into preview
This commit is contained in:
commit
574e645e7e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved (Preview)
|
// @name Bilibili Evolved (Preview)
|
||||||
// @version 1.6.7
|
// @version 1.6.8
|
||||||
// @description 增强哔哩哔哩Web端体验(预览版分支): 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等.
|
// @description 增强哔哩哔哩Web端体验(预览版分支): 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等.
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2018, Grant Howrad (https://github.com/the1812)
|
// @copyright 2018, Grant Howrad (https://github.com/the1812)
|
||||||
@ -468,6 +468,10 @@
|
|||||||
defaultPlayerMode: "默认播放器模式",
|
defaultPlayerMode: "默认播放器模式",
|
||||||
autoLightOff: "播放时自动关灯",
|
autoLightOff: "播放时自动关灯",
|
||||||
},
|
},
|
||||||
|
dropdown: {
|
||||||
|
key: "defaultPlayerMode",
|
||||||
|
items: ["常规", "宽屏", "网页全屏"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
useDefaultVideoQuality: {
|
useDefaultVideoQuality: {
|
||||||
path: "min/default-video-quality.min.js",
|
path: "min/default-video-quality.min.js",
|
||||||
@ -475,6 +479,10 @@
|
|||||||
useDefaultVideoQuality: "使用默认视频画质",
|
useDefaultVideoQuality: "使用默认视频画质",
|
||||||
defaultVideoQuality: "画质设定",
|
defaultVideoQuality: "画质设定",
|
||||||
},
|
},
|
||||||
|
dropdown: {
|
||||||
|
key: "defaultVideoQuality",
|
||||||
|
items: ["1080P60", "1080P+", "1080P", "720P", "480P", "360P", "自动"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
comboLike: {
|
comboLike: {
|
||||||
path: "min/combo-like.min.js",
|
path: "min/combo-like.min.js",
|
||||||
@ -487,6 +495,7 @@
|
|||||||
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/";
|
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/";
|
||||||
Resource.all = {};
|
Resource.all = {};
|
||||||
Resource.displayNames = {};
|
Resource.displayNames = {};
|
||||||
|
Resource.manifest = resourceManifest;
|
||||||
for (const [key, data] of Object.entries(resourceManifest))
|
for (const [key, data] of Object.entries(resourceManifest))
|
||||||
{
|
{
|
||||||
const resource = new Resource(data.path, data.order, data.styles);
|
const resource = new Resource(data.path, data.order, data.styles);
|
||||||
@ -1259,6 +1268,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
|
await this.applyDropdownOptions();
|
||||||
await this.applyWidgets();
|
await this.applyWidgets();
|
||||||
saveSettings(settings);
|
saveSettings(settings);
|
||||||
}
|
}
|
||||||
@ -1314,6 +1324,28 @@
|
|||||||
.map(it => applyWidget(it.widget))
|
.map(it => applyWidget(it.widget))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
async applyDropdownOptions()
|
||||||
|
{
|
||||||
|
async function applyDropdownOption(info)
|
||||||
|
{
|
||||||
|
const dropdown = await SpinQuery.any(
|
||||||
|
() => $(`.gui-settings-dropdown:has(input[key=${info.key}])`));
|
||||||
|
const list = dropdown.find("ul");
|
||||||
|
const input = dropdown.find("input");
|
||||||
|
info.items.forEach(item =>
|
||||||
|
{
|
||||||
|
$(`<li>${item}</li>`).appendTo(list)
|
||||||
|
.on("click", () =>
|
||||||
|
{
|
||||||
|
input.val(item).trigger("input").change();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await Promise.all(Object.values(Resource.manifest)
|
||||||
|
.filter(it => it.dropdown)
|
||||||
|
.map(it => applyDropdownOption(it.dropdown))
|
||||||
|
);
|
||||||
|
}
|
||||||
getDefaultStyleId(key)
|
getDefaultStyleId(key)
|
||||||
{
|
{
|
||||||
return key.replace(/([a-z][A-Z])/g,
|
return key.replace(/([a-z][A-Z])/g,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved
|
// @name Bilibili Evolved
|
||||||
// @version 1.6.7
|
// @version 1.6.8
|
||||||
// @description 增强哔哩哔哩Web端体验: 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等.
|
// @description 增强哔哩哔哩Web端体验: 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等.
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2018, Grant Howrad (https://github.com/the1812)
|
// @copyright 2018, Grant Howrad (https://github.com/the1812)
|
||||||
@ -468,6 +468,10 @@
|
|||||||
defaultPlayerMode: "默认播放器模式",
|
defaultPlayerMode: "默认播放器模式",
|
||||||
autoLightOff: "播放时自动关灯",
|
autoLightOff: "播放时自动关灯",
|
||||||
},
|
},
|
||||||
|
dropdown: {
|
||||||
|
key: "defaultPlayerMode",
|
||||||
|
items: ["常规", "宽屏", "网页全屏"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
useDefaultVideoQuality: {
|
useDefaultVideoQuality: {
|
||||||
path: "min/default-video-quality.min.js",
|
path: "min/default-video-quality.min.js",
|
||||||
@ -475,6 +479,10 @@
|
|||||||
useDefaultVideoQuality: "使用默认视频画质",
|
useDefaultVideoQuality: "使用默认视频画质",
|
||||||
defaultVideoQuality: "画质设定",
|
defaultVideoQuality: "画质设定",
|
||||||
},
|
},
|
||||||
|
dropdown: {
|
||||||
|
key: "defaultVideoQuality",
|
||||||
|
items: ["1080P60", "1080P+", "1080P", "720P", "480P", "360P", "自动"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
comboLike: {
|
comboLike: {
|
||||||
path: "min/combo-like.min.js",
|
path: "min/combo-like.min.js",
|
||||||
@ -487,6 +495,7 @@
|
|||||||
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/";
|
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/";
|
||||||
Resource.all = {};
|
Resource.all = {};
|
||||||
Resource.displayNames = {};
|
Resource.displayNames = {};
|
||||||
|
Resource.manifest = resourceManifest;
|
||||||
for (const [key, data] of Object.entries(resourceManifest))
|
for (const [key, data] of Object.entries(resourceManifest))
|
||||||
{
|
{
|
||||||
const resource = new Resource(data.path, data.order, data.styles);
|
const resource = new Resource(data.path, data.order, data.styles);
|
||||||
@ -1259,6 +1268,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
|
await this.applyDropdownOptions();
|
||||||
await this.applyWidgets();
|
await this.applyWidgets();
|
||||||
saveSettings(settings);
|
saveSettings(settings);
|
||||||
}
|
}
|
||||||
@ -1314,6 +1324,28 @@
|
|||||||
.map(it => applyWidget(it.widget))
|
.map(it => applyWidget(it.widget))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
async applyDropdownOptions()
|
||||||
|
{
|
||||||
|
async function applyDropdownOption(info)
|
||||||
|
{
|
||||||
|
const dropdown = await SpinQuery.any(
|
||||||
|
() => $(`.gui-settings-dropdown:has(input[key=${info.key}])`));
|
||||||
|
const list = dropdown.find("ul");
|
||||||
|
const input = dropdown.find("input");
|
||||||
|
info.items.forEach(item =>
|
||||||
|
{
|
||||||
|
$(`<li>${item}</li>`).appendTo(list)
|
||||||
|
.on("click", () =>
|
||||||
|
{
|
||||||
|
input.val(item).trigger("input").change();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await Promise.all(Object.values(Resource.manifest)
|
||||||
|
.filter(it => it.dropdown)
|
||||||
|
.map(it => applyDropdownOption(it.dropdown))
|
||||||
|
);
|
||||||
|
}
|
||||||
getDefaultStyleId(key)
|
getDefaultStyleId(key)
|
||||||
{
|
{
|
||||||
return key.replace(/([a-z][A-Z])/g,
|
return key.replace(/([a-z][A-Z])/g,
|
||||||
|
|||||||
2
min/default-player-mode.min.js
vendored
2
min/default-player-mode.min.js
vendored
@ -1 +1 @@
|
|||||||
(()=>{return(e,i)=>{const n=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{$(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{$(".bilibili-player-video-web-fullscreen").click()}}];SpinQuery.any(()=>$(".gui-settings-dropdown:has(input[key=defaultPlayerMode])"),e=>{const i=e.find("ul");const t=e.find("input");Object.values(n).forEach(e=>{$(`<li>${e.name}</li>`).appendTo(i).on("click",()=>{t.val(e.name).trigger("input").change()})})});let t=()=>{};async function l(){if(e.autoLightOff){const e=await SpinQuery.unsafeJquery();const i=await SpinQuery.any(()=>e(".bilibili-player-video-btn-setting"));i.mouseover().mouseout();t=(()=>{SpinQuery.any(()=>$(".bilibili-player-video-btn-setting-panel-others-content-lightoff .bui-checkbox-input"),e=>{const i=e[0];const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);i.checked=true;i.dispatchEvent(n)})})}}async function a(){await l();await SpinQuery.condition(()=>$(".bilibili-player-video,.bilibili-player-video-btn-start,.bilibili-player-area"),e=>e.length===3&&$("video").length>0&&$("video").prop("duration"));const i=document.querySelector("video");if(i.length===0){return}const a=n.find(i=>i.name===e.defaultPlayerMode);if(a.name==="全屏"){const e=await SpinQuery.unsafeJquery();const i=document.querySelector(".bilibili-player-video-btn-start");const n=()=>{const t=e(".bilibili-player-video-btn-fullscreen").data("events");if(t.click&&t.click[0]&&t.click[0].handler){const i=e(".bilibili-player-video-btn-fullscreen").data("events").click[0].handler;console.log(i);i()}i.removeEventListener("click",n)};i.addEventListener("click",n)}else{const e=()=>{if(a&&$("#bilibiliPlayer[class*=mode-]").length===0){a.action()}t();i.removeEventListener("play",e)};i.addEventListener("play",e)}}Observer.subtree("#bofqi",()=>a())}})();
|
(()=>{return(e,i)=>{const n=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{$(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{$(".bilibili-player-video-web-fullscreen").click()}}];let t=()=>{};async function l(){if(e.autoLightOff){const e=await SpinQuery.unsafeJquery();const i=await SpinQuery.any(()=>e(".bilibili-player-video-btn-setting"));i.mouseover().mouseout();t=(()=>{SpinQuery.any(()=>$(".bilibili-player-video-btn-setting-panel-others-content-lightoff .bui-checkbox-input"),e=>{const i=e[0];const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);i.checked=true;i.dispatchEvent(n)})})}}async function a(){await l();await SpinQuery.condition(()=>$(".bilibili-player-video,.bilibili-player-video-btn-start,.bilibili-player-area"),e=>e.length===3&&$("video").length>0&&$("video").prop("duration"));const i=document.querySelector("video");if(i.length===0){return}const a=n.find(i=>i.name===e.defaultPlayerMode);if(a.name==="全屏"){const e=await SpinQuery.unsafeJquery();const i=document.querySelector(".bilibili-player-video-btn-start");const n=()=>{const t=e(".bilibili-player-video-btn-fullscreen").data("events");if(t.click&&t.click[0]&&t.click[0].handler){const i=e(".bilibili-player-video-btn-fullscreen").data("events").click[0].handler;console.log(i);i()}i.removeEventListener("click",n)};i.addEventListener("click",n)}else{const e=()=>{if(a&&$("#bilibiliPlayer[class*=mode-]").length===0){a.action()}t();i.removeEventListener("play",e)};i.addEventListener("play",e)}}Observer.subtree("#bofqi",()=>a())}})();
|
||||||
2
min/default-video-quality.min.js
vendored
2
min/default-video-quality.min.js
vendored
@ -1 +1 @@
|
|||||||
(()=>{return(e,a)=>{(async()=>{const a=[{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];const t=await SpinQuery.any(()=>$(".gui-settings-dropdown:has(input[key=defaultVideoQuality])"));const i=t.find("ul");const n=t.find("input");a.forEach(e=>{$(`<li>${e.name}</li>`).appendTo(i).on("click",()=>{n.val(e.name).trigger("input").change()})});const l=await SpinQuery.condition(()=>$(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),e=>e.length>0&&$("li.profile-info").length>0);const[u]=l.toArray().map(e=>e.getAttribute("data-value")).sort().reverse();const[o]=a.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value);const[r]=a.map(e=>e.value).filter(e=>e<=Math.min(o,u)).sort().reverse();l.each((e,a)=>{if(parseInt(a.getAttribute("data-value"))===r){a.click()}})})()}})();
|
(()=>{return(e,a)=>{const t=[{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];(async()=>{const a=await SpinQuery.condition(()=>$(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),e=>e.length>0&&$("li.profile-info").length>0);const[l]=a.toArray().map(e=>e.getAttribute("data-value")).sort().reverse();const[i]=t.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value);const[n]=t.map(e=>e.value).filter(e=>e<=Math.min(i,l)).sort().reverse();a.each((e,a)=>{if(parseInt(a.getAttribute("data-value"))===n){a.click()}})})()}})();
|
||||||
2
min/gui-settings.min.js
vendored
2
min/gui-settings.min.js
vendored
File diff suppressed because one or more lines are too long
@ -56,9 +56,7 @@
|
|||||||
},
|
},
|
||||||
defaultPlayerMode: text =>
|
defaultPlayerMode: text =>
|
||||||
{
|
{
|
||||||
if (["常规", "宽屏", "网页全屏",
|
if (Resource.manifest.useDefaultPlayerMode.dropdown.items.indexOf(text) !== -1)
|
||||||
//"全屏"
|
|
||||||
].indexOf(text) !== -1)
|
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
@ -66,15 +64,7 @@
|
|||||||
},
|
},
|
||||||
defaultVideoQuality: text =>
|
defaultVideoQuality: text =>
|
||||||
{
|
{
|
||||||
if ([
|
if (Resource.manifest.useDefaultVideoQuality.dropdown.items.indexOf(text) !== -1)
|
||||||
"1080P60",
|
|
||||||
"1080P+",
|
|
||||||
"1080P",
|
|
||||||
"720P",
|
|
||||||
"480P",
|
|
||||||
"360P",
|
|
||||||
"自动",
|
|
||||||
].indexOf(text) !== -1)
|
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
1.6.7
|
1.6.8
|
||||||
@ -25,22 +25,6 @@
|
|||||||
// name: "全屏",
|
// name: "全屏",
|
||||||
// },
|
// },
|
||||||
];
|
];
|
||||||
SpinQuery.any(
|
|
||||||
() => $(".gui-settings-dropdown:has(input[key=defaultPlayerMode])"),
|
|
||||||
dropdown =>
|
|
||||||
{
|
|
||||||
const list = dropdown.find("ul");
|
|
||||||
const input = dropdown.find("input");
|
|
||||||
Object.values(playerModes).forEach(value =>
|
|
||||||
{
|
|
||||||
$(`<li>${value.name}</li>`).appendTo(list)
|
|
||||||
.on("click", () =>
|
|
||||||
{
|
|
||||||
input.val(value.name).trigger("input").change();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
let lightOff = () => { };
|
let lightOff = () => { };
|
||||||
async function initLightOff()
|
async function initLightOff()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,51 +2,38 @@
|
|||||||
{
|
{
|
||||||
return (settings, resources) =>
|
return (settings, resources) =>
|
||||||
{
|
{
|
||||||
|
const qualities = [
|
||||||
|
{
|
||||||
|
name: "1080P60",
|
||||||
|
value: 116,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1080P+",
|
||||||
|
value: 112,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1080P",
|
||||||
|
value: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "720P",
|
||||||
|
value: 64
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "480P",
|
||||||
|
value: 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "360P",
|
||||||
|
value: 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "自动",
|
||||||
|
value: 0
|
||||||
|
},
|
||||||
|
];
|
||||||
(async () =>
|
(async () =>
|
||||||
{
|
{
|
||||||
const qualities = [
|
|
||||||
{
|
|
||||||
name: "1080P60",
|
|
||||||
value: 116,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1080P+",
|
|
||||||
value: 112,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1080P",
|
|
||||||
value: 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "720P",
|
|
||||||
value: 64
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "480P",
|
|
||||||
value: 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "360P",
|
|
||||||
value: 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "自动",
|
|
||||||
value: 0
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const dropdown = await SpinQuery.any(
|
|
||||||
() => $(".gui-settings-dropdown:has(input[key=defaultVideoQuality])"));
|
|
||||||
const list = dropdown.find("ul");
|
|
||||||
const input = dropdown.find("input");
|
|
||||||
qualities.forEach(item =>
|
|
||||||
{
|
|
||||||
$(`<li>${item.name}</li>`).appendTo(list)
|
|
||||||
.on("click", () =>
|
|
||||||
{
|
|
||||||
input.val(item.name).trigger("input").change();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const qualityItems = await SpinQuery.condition(
|
const qualityItems = await SpinQuery.condition(
|
||||||
() => $(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),
|
() => $(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),
|
||||||
it => it.length > 0 && $("li.profile-info").length > 0
|
it => it.length > 0 && $("li.profile-info").length > 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user